RoboFont › Forums › Help / General › Vanilla TextBox .set()
This topic contains 4 replies, has 2 voices, and was last updated by frederik 6 years, 6 months ago.
-
AuthorPosts
-
March 24, 2014 at 15:29 #5819
Hello,
I am using a TextBox in a FloatingWindow:
def __init__(self): self.w = FloatingWindow((200, 75)) self.w.textBox = TextBox((10, 30, -10, 20), "test", sizeStyle = "small") self.w.button = Button((10, -20, -10, 15), "Go!", sizeStyle = "mini", callback=self.showProgress)
The Button here is used to start an action (self.defineGlyphsToMake), and I want the TextBox content text to be updated just before.
def showProgress(self, sender): self.w.textBox.set("Checking UFO...") glyphsToMake = self.defineGlyphsToMake(f, extrasL)The strange thing is that the textBox content is updated only _after_ the self.defineGlyphsToMake is finished.
Is there something I am doing wrong or is it a flaw in Vanilla ?March 24, 2014 at 15:40 #5820Cocoa is rather smart in updating views and this is a good example: it prevents the update while there is something else running.
You could force to update the view but maybe a better way is to use the defconAppKit base window and use the a progress from there.
from defconAppKit.windows.baseWindow import BaseWindowController from vanilla import * from time import sleep class Test(BaseWindowController): def __init__(self): self.w = Window((200, 40)) self.w.b = Button((10, 10, -10, 22), "Push", callback=self.buttonCallback) self.w.open() def buttonCallback(self, sender): progress = self.startProgress("Doing it...") for v in ["he", "I'm", "almost", "done"]: progress.update(v) sleep(0.5) progress.close() Test()good luck
March 24, 2014 at 15:54 #5821great thanks !
is there a doc for BaseWindowController ? the .startProgress for example?
I would like to use a determinate progress bar…March 24, 2014 at 16:37 #5824OK I found my way reading the sources of defconAppKit:
https://github.com/typesupply/defconAppKit/blob/master/Lib/defconAppKit/windows/progressWindow.py
self.progress.setTickCount(len(extrasDict.keys()))
for i in extrasDict.keys():
self.progress.update()thanks for your help Frederik :)
March 28, 2014 at 11:15 #5825source code is the best documentation :)
otherwise use:
from defconAppKit.windows.baseWindow import BaseWindowController from defconAppKit.windows.progressWindow import ProgressWindow help(BaseWindowController) help(ProgressWindow)
-
AuthorPosts
You must be logged in to reply to this topic.