S
Sam Bull
I'm writing a pyGTK program, and I need to display the contents of a
window for a few seconds before automatically moving on. I have tried
using the time.sleep method, but this has problems, such as the program
becoming unresponsive.
I have now attempted to use a timer, but this does not seem to run the
function at the end of the time. The code of my latest attempt:
def next(self=None, testnum=10, testspeed=5):
self.count += 1
#Sets label, telling the user the next word to memorise
self.nobtns.set_markup("Word %s is: %s" % (self.count,
self.words[self.count-1]))
self.nobtns.show()
if self.count == testnum: #When all words are shown
self.nobtns.hide()
else:
self.timer = threading.Timer(testspeed, self.next, [testnum,
testspeed])
self.timer.start()
Putting a print statement at the beginning of the function, I can see
that the function is not being run by the timer. Any help on getting
this working would be appreciated.
Thanks,
Sam Bull
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
iEYEABECAAYFAkugljAACgkQX+kozZYmzivkswCg5m7VeEdGyIZn6/3pzoFCXcHp
ytwAoIH3l9vl8s/OTnCBVILhzlwj7bD9
=RmJ6
-----END PGP SIGNATURE-----
window for a few seconds before automatically moving on. I have tried
using the time.sleep method, but this has problems, such as the program
becoming unresponsive.
I have now attempted to use a timer, but this does not seem to run the
function at the end of the time. The code of my latest attempt:
def next(self=None, testnum=10, testspeed=5):
self.count += 1
#Sets label, telling the user the next word to memorise
self.nobtns.set_markup("Word %s is: %s" % (self.count,
self.words[self.count-1]))
self.nobtns.show()
if self.count == testnum: #When all words are shown
self.nobtns.hide()
else:
self.timer = threading.Timer(testspeed, self.next, [testnum,
testspeed])
self.timer.start()
Putting a print statement at the beginning of the function, I can see
that the function is not being run by the timer. Any help on getting
this working would be appreciated.
Thanks,
Sam Bull
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
iEYEABECAAYFAkugljAACgkQX+kozZYmzivkswCg5m7VeEdGyIZn6/3pzoFCXcHp
ytwAoIH3l9vl8s/OTnCBVILhzlwj7bD9
=RmJ6
-----END PGP SIGNATURE-----