Vanilla set.text to TextBox

RoboFont Forums Help / General Vanilla set.text to TextBox

Tagged: ,

This topic contains 1 reply, has 2 voices, and was last updated by  frederik 7 years, 7 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #5480

    joanca
    Participant

    I know this is a vanilla question but probably it will be easy to answer by someone.
    I want to set the text to a TextBox (for a progressbar, to follow what’s going on) but I can’t get it updated. Any help?

    from vanilla import *
    from time import sleep
    
    class Test():
        def __init__ (self):
            self.w = Window((200, 100), 'a W')
            
            self.w.text = TextBox((10, 10, -10, -10), 'start')
            
            self.w.open()
            
            # set text
            self.counter = 0
            while self.counter < 10:
                print self.counter
                self.w.text.set(self.counter)
                sleep(1)
                self.counter += 2
            else:
                print 'finished counting'
                
            
    Test()
    
    #5481

    frederik
    Keymaster

    can you use the defconAppKit progressWindow?

    see http://code.typesupply.com/browser/packages/defconAppKit/trunk/Lib/defconAppKit/windows/progressWindow.py

    Cocoa is build up rather smart so it checks when a view is been updated frequently before redrawing it on screen.

    Although you can force a redraw:

    self.w.text.getNSTextField().display()

    after setting a string into the TextBox

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.