473,569 Members | 2,844 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can I set up a timed callback without Tkinter or twisted or something?

Hi,

I want to do the equivalent of the after thingy in tkinter - setting up in
effect a timed call back.

My use case is as a "supervisor y" timer - I want to set up an alarm, which I
want to cancel if the expected occurrence occurs - but its not a GUI app.

My googling gets a lot of stuff pointing to optparse...

Does the standard lib have anything like this?

- Hendrik

Oct 14 '06 #1
6 1671
Hendrik van Rooyen wrote:
I want to do the equivalent of the after thingy in tkinter - setting up in
effect a timed call back.

My use case is as a "supervisor y" timer - I want to set up an alarm, which I
want to cancel if the expected occurrence occurs - but its not a GUI app.
Use a thread that uses something like:
def action():
sleep(50)
if not canceled:
callback(foo)
as its action.

The callback ill be in another thread, but .... Look up threading for
more details.
--Scott David Daniels
sc***********@a cm.org
Oct 14 '06 #2
hg
Hendrik van Rooyen wrote:
Hi,

I want to do the equivalent of the after thingy in tkinter - setting up in
effect a timed call back.

My use case is as a "supervisor y" timer - I want to set up an alarm, which I
want to cancel if the expected occurrence occurs - but its not a GUI app.

My googling gets a lot of stuff pointing to optparse...

Does the standard lib have anything like this?

- Hendrik
http://python.active-venture.com/lib/timer-objects.html
Oct 14 '06 #3
"Scott David Daniels" <sc***********@ acm.orgwrote:

Hendrik van Rooyen wrote:
I want to do the equivalent of the after thingy in tkinter - setting up in
effect a timed call back.

My use case is as a "supervisor y" timer - I want to set up an alarm, which I
want to cancel if the expected occurrence occurs - but its not a GUI app.

Use a thread that uses something like:
def action():
sleep(50)
if not canceled:
callback(foo)
as its action.

The callback ill be in another thread, but .... Look up threading for
more details.
Thanks - I was hoping that I did not have to do it myself - the Tkinter thingy
works nicely - I was hoping that the interpreter could handle something like
this... What I don't like too much about the sleep based solution is that yer
blind and deaf while sleeping - at least in that thread - and I am trying for
fairly fine grained timing resolution...

is there not something based on signals? - I seem to recall some such thing
here in another thread.. ( I am running Linux)

-Hendrik

Oct 15 '06 #4

"hg" <hg@nospam.comw rote:

Hendrik van Rooyen wrote:
Hi,

I want to do the equivalent of the after thingy in tkinter - setting up in
effect a timed call back.

My use case is as a "supervisor y" timer - I want to set up an alarm, which I
want to cancel if the expected occurrence occurs - but its not a GUI app.

My googling gets a lot of stuff pointing to optparse...

Does the standard lib have anything like this?

- Hendrik

http://python.active-venture.com/lib/timer-objects.html
Thanks - will check it out - Hendrik

Oct 15 '06 #5

Hendrikis there not something based on signals? - I seem to recall
Hendriksome such thing here in another thread.. ( I am running Linux)

Have you tried:

import signal
help(signal)

at the interpreter prompt?

Skip
Oct 15 '06 #6

<sk**@pobox.com wrote:
>
Hendrikis there not something based on signals? - I seem to recall
Hendriksome such thing here in another thread.. ( I am running Linux)

Have you tried:

import signal
help(signal)

at the interpreter prompt?

Skip
*blush* - actually, no - I was looking for signals...

- Hendrik

Oct 17 '06 #7

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

Similar topics

4
7537
by: Julia Goolia | last post by:
hello, i read that it is bad to use threads with tkinter. so my question is how does one create a gui program with sockets? at one point you have to call mainloop() which does not return. then you are not free to do stuff with the sockets. what's up with that? thanks so much for your time!
5
3829
by: george.trojan | last post by:
My application consists of Tkinter GUI that has to communicate with a remote server. The communication is bi-directional: the GUI responds to remote requests and user actions uch as pressing a button) should send messages to the server. I want to have the network interface implemented as a separate thread, as it may take a while to...
2
3403
by: John Pote | last post by:
Running my programme in Python 2.3.4 I received the following msg in the consol :- (Pent III running W2K prof) """ Exception in Tkinter callback Traceback (most recent call last): File "c:\apps\python\234\lib\lib-tk\Tkinter.py", line 1345, in __call__ return self.func(*args) File "c:\apps\python\234\lib\lib-tk\Tkinter.py", line 459, in...
12
12646
by: Tom | last post by:
1) Portable to Windows, Unix-like platforms, and the Macintosh; 2) Powerful, GUI is very beautiful ; 3) Efficiency of development is high; What's the best, Tkinter, wxPython, QT, GTK or other? Thanks!
0
853
by: William Gill | last post by:
I am creating several tkinter widgets. In my classes they each have a change() method that is a callback to various IntVar, and StringVar objects. Everything works fine, but don't really want to trigger the callback when I am initializing each widget/control variable. I can use a "flag" like self.initialized= true, and wrap the change()...
9
3421
by: Chris | last post by:
Does anyone know how to use twisted and tkinter. I have a simple tcp server and I want to send messages to it once connected using a tkinter button? I have built the code as far as I can but don't know what to do from here. Any reference I try to put to sendmessage in chatfactory doesn't seem to work, just brings up error messages. This is...
0
1801
by: Chris | last post by:
Hi, Sorry for reposting but I changed my code and received a new error message so I thought I would try it on the group again. I have a working server and this is meant to be a chat client using tkinter that connects to the server and sends messages. However I receive this error message when I click the send button: Traceback (most...
2
6639
by: erasmus | last post by:
It seems that in some cases the callback (command) function in a TkInter Button runs automatically when drawn for the first time. Example: b=Button(frame, text="Click me",command=myFunction()) b.pack() .. so, myFunction() executes when the screen is drawn for the first time. But (!) if I do not include the "()" after myFunction, then it does...
13
3340
by: Daniel Fetchinson | last post by:
Was looking at PEP 3108, http://www.python.org/dev/peps/pep-3108/ , Is it just me or others also think that it would be a major loss to remove tkinter from the python core? PEP 3108 starts off with: Each module to be removed needs to have a justification as to why it should no longer be distributed with Python. then goes on with,
0
7612
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...
0
7922
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8119
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7964
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...
1
5509
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...
0
5218
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...
0
3653
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...
0
3637
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
936
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...

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.