I need what I'd call (in .Net) a timer, ie I need to run a function eg
every 2 seconds - it doesn't need to be millisec accurate but it would
be nice if it wasn't eg every 4 seconds or something.
Rather surprisingly, Core Python (Chun) doesn't seem to index 'timer'
or 'scheduler', which leaves me wondering whether this is an aspect of
Python that isn't perhaps widely used?
Looking around on the net I can see references to a thread timer, but
I'm not really looking to start any new threads (I just want part of
the GUI to update every 2 secs) and don't want to get into that sort
of complication while still just learning Python.
Is there really no simple timer/scheduler function available in
Python? 4 3942
On 12 Jul., 11:30, John Dann <n...@prodata.co.ukwrote:
I need what I'd call (in .Net) a timer, ie I need to run a function eg
every 2 seconds - it doesn't need to be millisec accurate but it would
be nice if it wasn't eg every 4 seconds or something.
Rather surprisingly, Core Python (Chun) doesn't seem to index 'timer'
or 'scheduler', which leaves me wondering whether this is an aspect of
Python that isn't perhaps widely used?
Looking around on the net I can see references to a thread timer, but
I'm not really looking to start any new threads (I just want part of
the GUI to update every 2 secs) and don't want to get into that sort
of complication while still just learning Python.
Is there really no simple timer/scheduler function available in
Python?
The usual way is to use threads. Depending on you GUI lib there may
exist
replacements for threads, eg wxPython. As most (all ?) GUIs have some
event handling
mechanisms they should be able to schedule tasks and process them in
the
background.
By the way: Using threads in Python is quite simple, even if you are
a novice.
Greetings, Uwe
On Sat, 12 Jul 2008 10:30:00 +0100, John Dann wrote:
Looking around on the net I can see references to a thread timer, but
I'm not really looking to start any new threads (I just want part of
the GUI to update every 2 secs) and don't want to get into that sort
of complication while still just learning Python.
Look into the GUI toolkit because that's typically something solved with
functions from the specific toolkit.
Is there really no simple timer/scheduler function available in
Python?
You can do that quite easily with threads but almost all GUI toolkits
don't like it if you access the GUI from multiple threads.
Ciao,
Marc 'BlackJack' Rintsch
I need what I'd call (in .Net) a timer, ie I need to run a function eg
every 2 seconds - it doesn't need to be millisec accurate but it would
be nice if it wasn't eg every 4 seconds or something.
Rather surprisingly, Core Python (Chun) doesn't seem to index 'timer'
or 'scheduler', which leaves me wondering whether this is an aspect of
Python that isn't perhaps widely used?
Looking around on the net I can see references to a thread timer, but
I'm not really looking to start any new threads (I just want part of
the GUI to update every 2 secs) and don't want to get into that sort
of complication while still just learning Python.
Is there really no simple timer/scheduler function available in
Python?
You might want to look at scheduler.py from turbogears which is
exactly the tool you describe and luckily is 99.99% independent of
turbogears. I'd think you need to modify 1-2 lines: http://svn.turbogears.org/tags/1.0.4...s/scheduler.py
Cheers,
Daniel
--
Psss, psss, put it down! - http://www.cafepress.com/putitdown
There is a module called sched in the standard Python library
<http://docs.python.org/lib/module-sched.html>
/Jean Brouwers
John Dann wrote:
I need what I'd call (in .Net) a timer, ie I need to run a function eg
every 2 seconds - it doesn't need to be millisec accurate but it would
be nice if it wasn't eg every 4 seconds or something.
Rather surprisingly, Core Python (Chun) doesn't seem to index 'timer'
or 'scheduler', which leaves me wondering whether this is an aspect of
Python that isn't perhaps widely used?
Looking around on the net I can see references to a thread timer, but
I'm not really looking to start any new threads (I just want part of
the GUI to update every 2 secs) and don't want to get into that sort
of complication while still just learning Python.
Is there really no simple timer/scheduler function available in
Python?
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Eric |
last post by:
I'm trying to have some scripts run periodically on Windows XP and found the "Task Scheduler" did not execute my scripts. My scripts are of the form scriptName.py, and will run just by invoking that...
|
by: chrisdevey |
last post by:
Is there any way to make a System.Timers.Timer adjust for daylight
savings time change? In a long running process I set a timer as follows
for a daily expiration:
_myTimer = new...
|
by: sm |
last post by:
Hi All,
I need to do a task at 3pm everyday. How do I set up the timer so that the
timer procedure executes at 3pm everyday? Is there any other solution other
than using a timer?
Thanks.
|
by: Mark |
last post by:
Hello,
Does anyone know of a timer control which has similar functionality as the
scheduler in SQL server?
I'm most interested in being able to set up recurring tasks.
I want to stay away...
|
by: Rohan |
last post by:
Hello,
I would like my script to run once a week with out any external
interference.
More like a timer. Can it be done in python or should some other shell
scripting be used.
If anyone knows...
| |
by: elaine |
last post by:
I have a web appliacation, what i want to do is starting a timer when
"Application_Start" event handler is called. The timer is running
asyncronizely, let's say, every 24 hours, it will create a...
|
by: Prof. William Battersea |
last post by:
I'd like a class method to fire every n seconds.
I tried this:
class Timed:
def.__init__(self):
self.t = Timer(3, self.dothing)
def.start(self):
self.t.start()
|
by: Rob Weir |
last post by:
On 14 Aug 2008, William Battersea wrote:
That's how both ('sched' and threading.Timer) of the them work.
Depending on what you're doing, your toolkit/framework (Twisted, GTK,
etc) might have a...
|
by: =?GB2312?B?zPC5zw==?= |
last post by:
Howdy,
I use python2.5 in WindowsXP. If using time.time() as timer, it seems
the maximum precision is about 10-12ms. Maybe this is caused by
the time slice defined in process scheduler. However,...
|
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,...
|
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...
| |
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,...
|
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...
|
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...
|
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...
|
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...
|
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...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |