View Single Post
omeriko9's Avatar
Posts: 385 | Thanked: 344 times | Joined on Jan 2010 @ Israel
#8
Originally Posted by McLightning View Post
import threading
class gui(threading.Thread):
__def __init__(self):
____self.a=0
____.......
____threading.Thread.__init__(self)
__def run(self):
____while 1:
______print self.a
______self.a=self.a+1

gui().start()
gtk.main()

but in this case print function stopping after gtk.main() shows up
im sorry i know im asking a lot :/ :/ im a total noob :/
thanks for help

EDIT: it starts to print again after i close gtkwindow
It doesn't stop. I think you just can't see it because you see the GUI now.

try adding writing a to a file, you can see it keeps after you see the gui:

Code:
class gui(threading.Thread):
__def __init__(self):
____self.a=0
____.......
____threading.Thread.__init__(self)
__def run(self):
____f = open('/home/user/t.txt', 'a')
____while 1:
______print self.a
______f.write(str(self.a))
______self.a=self.a+1

gui().start()
gtk.main()