Search Results

Search found 6 results on 1 pages for 'wtzolt'.

Page 1/1 | 1 

  • pyglet and animated gif

    - by wtzolt
    Hello, I have a message box pop up when a certain operation is being executed sort of "wait..." window and I want to have a "loading" *.gif animation there to lighten up the mood :) Anyways I can't seem to figure out how to make this work. It's a complete mess. I tried calling through class but i get loads of errors to do with pyglet itself. class messageBox: def __init__(self, lbl_msg = 'Message here', dlg_title = ''): self.wTree = gtk.glade.XML('msgbox.glade') self.wTree.get_widget('label1').set_text(lbl_msg) self.wTree.get_widget('dialog1').set_title(dlg_title) ????sprite = pyglet.sprite.Sprite(pyglet.resource.animation("wait.gif")) ????self.wTree.get_widget('waitt').set_from_file(sprite) [email protected] ????def on_draw(): ???? win.clear() ???? sprite.draw() handlers = { 'on_okbutton1_clicked':self.gg } self.wTree.signal_autoconnect( handlers ) self.wTree.get_widget("dialog1").set_keep_above(True) def done(self): self.wTree.get_widget('dialog1').destroy() def gg(self,w): self.wTree.get_widget('dialog1').destroy() --------- @yieldsleep def popup(self, widget, data=None): self.msg = messageBox('Wait...','') ?what to call here? yield 500 print '1' yield 500 print '2' yield 500 print '3' self.msg.done() self.msg = messageBox('Done! ','') yield 700 self.msg.done()

    Read the article

  • Help calling def from class.

    - by wtzolt
    Hello, Noob question... class msgbox: def __init__(self, lbl_msg = '', dlg_title = ''): self.wTree = gtk.glade.XML('msgbox.glade') self.wTree.get_widget('dialog1').set_title(dlg_title) self.wTree.get_widget('label1').set_text(lbl_msg) self.wTree.signal_autoconnect( {'on_okbutton1_clicked':self.done} ) def done(self,w): self.wTree.get_widget('dialog1').destroy() class Fun(object): wTree = None def __init__(self): self.wTree = gtk.glade.XML( "main.glade" ) self.wTree.signal_autoconnect( {'on_buttonOne' : self.one,} ) gtk.main() @yieldsleep def one(self, widget, data=None): self.msg = msgbox('Please wait...','') yield 500 self.msg = msgbox().done() # <----------------??? self.msg = msgbox('Done!','') With this i get an error: messageBox().done() TypeError: done() takes exactly 2 arguments (1 given) How can i make the dialog box with "please wait" to close before the second dialog box with "done" appears?? Thank you.

    Read the article

  • GUI freezes when executing def function. Use threads?

    - by wtzolt
    Hi, I've made a small program which has 2 buttons and each does certain thing. Here's a simplified version of the code. Thing is it works fine except that the button freezes and stays in a clicked position and whole GUI freezes until the command is completed. As far as I know threads would be best to use in this situation, but I have no idea how to implement it in this example. I use glade and pygtk for gui. def do1: t = 2 #do something time.sleep(t) #do something time.sleep(t) def do2: t = 3 #do something time.sleep(t) #do something time.sleep(t) class we: wTree = None def __init__( self ): self.wTree = gtk.glade.XML( "ui.glade" ) dic = { "on_buttonSone" : self.sone, "on_buttonStwo" : self.stwo, } self.wTree.signal_autoconnect( dic ) gtk.main() def sone(self, widget): i = 0 while i < 3: t = 1 #do something i += 1 time.sleep(t) self.wTree.get_widget("entryResult").set_text("Done.") def stwo(self, widget): start = time.clock() array = ['A','B'] adict = {'A':do1,'B':do2} for f in array: adict[f]() end = time.clock() elapsed = end - start gg = round(elapsed,2) self.wTree.get_widget("entryResult").set_text(str(gg)) go=we()

    Read the article

  • Convert list to sequence of variables

    - by wtzolt
    I was wondering if this was possible... I have a sequence of variables that have to be assigned to a do.something (a, b) a and b variables accordingly. Something like this: # # Have a list of sequenced variables. list = 2:90 , 1:140 , 3:-40 , 4:60 # # "Template" on where to assign the variables from the list. do.something (a,b) # # Assign the variables from the list in a sequence with possibility of "in between" functions like print and time.sleep() added. do.something (2,90) time.sleep(1) print "Did something (%d,%d)" % (# # vars from list?) do.something (1,140) time.sleep(1) print "Did something (%d,%d)" % (# # vars from list?) do.something (3,-40) time.sleep(1) print "Did something (%d,%d)" % (# # vars from list?) do.something (4,60) time.sleep(1) print "Did something (%d,%d)" % (# # vars from list?) Any ideas?

    Read the article

  • Simple pygtk and threads example please.

    - by wtzolt
    Hello, Can someone give me a simple example involving threads in this manner, please. Problem with my code is that when I click button One, GUI freezes until its finished. I want buttons to stay responsive when def is being executed. How can i fix that? class fun: wTree = None def __init__( self ): self.wTree = gtk.glade.XML( "ui.glade" ) dic = { "on_buttonOne" : self.one, "on_buttonTwo" : self.two, } self.wTree.signal_autoconnect( dic ) gtk.main() def sone(self, widget): time.sleep(1) print "1" time.sleep(1) print "2" time.sleep(1) print "3" def stwo(self, widget): time.sleep(1) print "4" time.sleep(1) print "5" time.sleep(1) print "6" do=fun() Pretty please, help me.

    Read the article

  • Help calling class from a class above.

    - by wtzolt
    Hello, How to call from class oneThread: back to class fun:? As in, address a class written below. Is it possible? class oneThread(threading.Thread): def __init__(self): threading.Thread.__init__(self) self.start() def run(self): print "1" time.sleep(1) print "2" time.sleep(1) print "3" self.wTree.get_widget("entryResult").set_text("Done with One.") # How to call from here back to class fun, which of course is below...? class fun: wTree = None def __init__( self ): self.wTree = gtk.glade.XML( "main.glade" ) self.wTree.signal_autoconnect( {"on_buttonOne" : self.one} ) gtk.main() def one(self, widget): oneThread(); gtk.gdk.threads_init() do=fun()

    Read the article

1