473,508 Members | 2,380 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Real-time Update

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 ?

Jul 18 '07 #1
6 1933
In article <11**********************@i13g2000prf.googlegroups .com>,
ReTrY <re****@gmail.comwrote:
>
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.
--
Aahz (aa**@pythoncraft.com) <* http://www.pythoncraft.com/

I support the RKAB
Jul 18 '07 #2
"ReTrY" <re****@gmail.comwrote:
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

Jul 19 '07 #3
On Jul 18, 3:24 am, ReTrY <ret...@gmail.comwrote:
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

Jul 19 '07 #4
On Jul 18, 4:43 pm, a...@pythoncraft.com (Aahz) wrote:
In article <1184747090.102324.265...@i13g2000prf.googlegroups .com>,

ReTrY <ret...@gmail.comwrote:
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.
--
Aahz (a...@pythoncraft.com) <* http://www.pythoncraft.com/

I support the RKAB
There's also a good example on the wxPython wiki dealing with threads
that you should be able to adapt to Tkinter.

http://wiki.wxpython.org/LongRunningTasks

Mike

Jul 19 '07 #5
Hendrik van Rooyen <ma**@microcorp.co.zawrote:
"ReTrY" <re****@gmail.comwrote:
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.
<http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/82965.
Alex

Jul 19 '07 #6

"Alex Martelli" <al***@mac.comwrote:

Hendrik van Rooyen <ma**@microcorp.co.zawrote:
there is a recipe for this sort of thing, but I keep losing links.

<http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/82965.
thanks - but its probably no use - I predict I will lose this too...

: - )

- Hendrik

Jul 20 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1940
by: cwdjr | last post by:
Real One has a page to copy on their site that detects if the browser of a viewer of a page has Real One installed. The page is located at...
6
2805
by: Paul | last post by:
In real life situation, do we ever come across a situation where we would need two base objects in an object. A snippet is worth 1000 words (: so... class Base { }; class Derived1:public Base...
4
2284
by: Allan Adler | last post by:
I'm trying to reinstall RedHat 7.1 Linux on a PC that was disabled when I tried to upgrade from RH7.1 to RH9. This is presenting lots of unexpected difficulties. Apart from wanting to keep the old...
10
2678
by: Pavils Jurjans | last post by:
Hallo, It is know issue that due to the fact that computer has to store the real numbers in limited set of bytes, thus causing a minor imprecision from the decimal value that likely was stored....
17
4342
by: David Scemama | last post by:
Hi, I'm writing a program using VB.NET that needs to communicate with a DOS Pascal program than cannot be modified. The communication channel is through some file databases, and I have a huge...
5
2711
by: Henry Wu | last post by:
Hi, now that in .NET everything is on millimeter, I was wondering how can one convert Pixel to Millimeter and any user's screen/monitor. I saw the following code on how to convert pixel to...
0
1549
by: support | last post by:
Veteran Real Estate Investor Shares some of his best Insider Secrets for successful investments! www.RealEstateBeginners.ws Have you ever wondered about investing in real estate? Maybe one...
12
2066
by: Raymond Hettinger | last post by:
I am evaluating a request for an alternate version of itertools.izip() that has a None fill-in feature like the built-in map function: >>> map(None, 'abc', '12345') # demonstrate map's None...
16
10832
by: DirtyHarry | last post by:
Good day everyone. This sounds like a stupid question, but I became just curious yesterday, and I looked up several textbooks. However, no textbooks on computer language (that I have ) mentioned...
2
7320
by: Tim | last post by:
Folks, Can anyone thow some clarifying light on the following? I have come across a column with the same name and same data contents defined on different tables, on some the column is defined...
0
7223
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7115
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7321
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7377
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7489
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5624
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5047
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
1
762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
414
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.