[Patches] [ python-Patches-1304895 ] Strobe Timer for guis

SourceForge.net noreply at sourceforge.net
Thu Mar 8 23:03:52 CET 2007


Patches item #1304895, was opened at 2005-09-26 16:51
Message generated for change (Comment added) made by sonderblade
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1304895&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Modules
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Brett Rosen (bdrosen)
Assigned to: Nobody/Anonymous (nobody)
Summary: Strobe Timer for guis

Initial Comment:
Often when doing gui work it is useful to queue up
a task to run at some later time - either once or
periodically. Although you can use the thread
support to do this, it is problematic because:

1 one because if the work being done is gui related, it
often needs to be done in the same thread which owns
the gui 

2 it is easier to not need to code using threads if you
don't need to

3 having multiple threads executing at once doesn't scale
so well, especially when you have lots of idle time in
a gui app.

I created this module to get around this problem. In
you gui, you would add _timers.AppServiceTimers
to your onIdle method (or whatever method get
called for idle processing)

Then to register an event to be run you would do:

import _timers


a = _timers.StrobeTimer()
a.Interval(500)
def MyStrobe(self):
        print "I am called every 500 ms", self
a.Strobe = MyStrobe
a.StartTimer()

# do some work

a.StopTimer()



----------------------------------------------------------------------

Comment By: Björn Lindqvist (sonderblade)
Date: 2007-03-08 23:03

Message:
Logged In: YES 
user_id=51702
Originator: NO

Thank you for your contribution! However, most GUI libraries already come
with their own timer implementations. Also, there is no gain in writing it
in C, since the execution speed of the timer class is not important.
Additionally, the coding and naming style in the code is inconsistent and
not in compliance with PEP7. For these reasons, I think the patch should
not be accepted.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1304895&group_id=5470


More information about the Patches mailing list