473,662 Members | 2,752 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 1941
In article <11************ **********@i13g 2000prf.googleg roups.com>,
ReTrY <re****@gmail.c omwrote:
>
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**@pythoncra ft.com) <* http://www.pythoncraft.com/

I support the RKAB
Jul 18 '07 #2
"ReTrY" <re****@gmail.c omwrote:
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.c omwrote:
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 "Programmin g 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...@pythoncraf t.com (Aahz) wrote:
In article <1184747090.102 324.265...@i13g 2000prf.googleg roups.com>,

ReTrY <ret...@gmail.c omwrote:
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...@pythoncra ft.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.c omwrote:
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.activestat e.com/ASPN/Cookbook/Python/Recipe/82965.
Alex

Jul 19 '07 #6

"Alex Martelli" <al***@mac.comw rote:

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

<http://aspn.activestat e.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
1945
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
2827
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
2290
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 model T in shape, I'm treating this as a learning experience. Right now, I'm trying to gain more control over the installation CD. By that I mean, I intend to modify the installation script and other aspects of the CD and burn a new installation...
10
2688
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. I don't know, how dotnet framework stored doubles, but it's certain, that if I store, say, 1.234567 in some real variable, it is stored in memory like something close to 1.2345670000000000000003454786544 or...
17
4361
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 problem writing VB Double values to the file so as the Pascal program can read them as Pascal Real values. I've managed to find the algorithm to read the Pascal Real format and convert it to a VB Double, but I cannot figure out the opposite...
5
2719
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 millimeter. It's done on pascal/delphi, but can be very easily read & converted to VB ..NET. However my question is what is the difference between "real" millimeters and "logical" millimeters? The source of the code is in the following thread:
0
1564
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 sleepless night you tuned in to one of those infomercials that promises you the moon. You know the ones we're talking about. They
12
2081
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 fill-in feature The movitation is to provide a means for looping over all data elements when the input lengths are unequal. The question of the day is whether that is both a common need and a good approach to real-world problems. The answer to...
16
10854
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 this. So I am asking to you, gurus... Is there any particular reason to call 'float' instead of 'real'?
2
7329
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 as a FLOAT on others it is a REAL. (Don't ask me why, it's inherited, legacy and due for removal once we have absorbed all the good bits into the data warehouse). .
0
8435
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8345
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8547
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8633
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6186
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5655
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4181
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1999
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1754
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.