Simple pygtk and threads example please.

Posted by wtzolt on Stack Overflow See other posts from Stack Overflow or by wtzolt
Published on 2010-04-10T21:45:36Z Indexed on 2010/04/10 22:33 UTC
Read the original article Hit count: 304

Filed under:
|

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.

© Stack Overflow or respective owner

Related posts about python

Related posts about pygtk