473,385 Members | 1,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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 "supervisory" 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 1658
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 "supervisory" 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***********@acm.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 "supervisory" 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 "supervisory" 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.comwrote:

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 "supervisory" 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.comwrote:
>
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
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. ...
5
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...
2
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...
12
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? ...
0
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...
9
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...
0
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...
2
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())...
13
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.