Double infinite loop

Arne Meyer Hansen arnehan at ifi.uio.no
Thu Nov 16 01:39:41 EST 2000


I'm writing a script that gathers information from newspapers and updates
it regularly with the newest headlines. The principle is simple:

while 1:
  updateHeadlines()
  time.sleep(180)

The trouble is, I want to display the results in a GUI, which requires
entering Tk's mainloop(). How can I combine the two infinte loops?

My best suggestions so far are:

- Binding some sort of timer-event that calls the updateHeadlines-function
at regular intervals (which seems reasonable, except that I'm not sure if
it is possible in Python. That is, I haven't found any documentation about
it).

- Threads. But I've heard somewhere that threads and Tkinter don't mix
well.

Or perhaps there's another way to do it?

Regards,
Arne Meyer Hansen



More information about the Python-list mailing list