Real-time Update

R

ReTrY

I'm writing a program with Tkinter GUI, When the program is running it
need to be updated every five seconds (data comes from internet). How
should I do that ? How to make a function in main loop ?
 
A

Aahz

I'm writing a program with Tkinter GUI, When the program is running it
need to be updated every five seconds (data comes from internet). How
should I do that ? How to make a function in main loop ?

See the Tkinter example from my threads tutorial on my website.
 
H

Hendrik van Rooyen

ReTrY said:
I'm writing a program with Tkinter GUI, When the program is running it
need to be updated every five seconds (data comes from internet). How
should I do that ? How to make a function in main loop ?

Short answer:

use the after method to set up a periodic scan of a queue.

In another thread, look for the new stuff, and put it on the queue when found.

there is a recipe for this sort of thing, but I keep losing links.

- Hendrik
 
K

kyosohma

I'm writing a program with Tkinter GUI, When the program is running it
need to be updated every five seconds (data comes from internet). How
should I do that ? How to make a function in main loop ?

I'm pretty sure the book "Programming Python 3rd Ed." by Lutz covers
this stuff in detail. I think it mentions using threads for this sort
of thing. The wxPython wiki has a good example that I think you could
adapt for Tkinter. Just use the threading code and wrap it in your
Tkinter code and I think you'll be good to go. Here's the link:
http://www.wxpython.org/maillist.php

Good luck,

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top