RE: Seeking to convert a py timer app for my Moto E6

2020-07-19 Thread Steve
ut. Thanks FootNote: If money does not grow on trees, then why do banks have branches? -Original Message- From: Python-list On Behalf Of Dennis Lee Bieber Sent: Saturday, July 18, 2020 12:04 PM To: python-list@python.org Subject: Re: Seeking to convert a py timer app for my Moto E6 On Sat, 1

Seeking to convert a py timer app for my Moto E6

2020-07-17 Thread Steve
I am looking for an app for my Moto e6 android phone that will accept a number of hours and then count down. Once the hours have been executed, it will quietly beep every minute until I cancel the app. This is to remind me (and keep on reminding me) when to take my insulin. It has been writt

Re: Multi-threading with a simple timer?

2018-07-04 Thread Gregory Ewing
Another way on unix that doesn't use signals: import select, sys print("Enter something: ", end = "") sys.stdout.flush() fds = select.select((0,), (), (), 5) if fds[0] == [0]: data = sys.stdin.readline() print("You entered:", data) else: print("Too late!") -- Greg -- https://mail.py

Re: Multi-threading with a simple timer?

2018-07-03 Thread David D
I have some success with this. I am not sure if this would work longer term, as in restarting it, but so far so good. Any issue with this new code? import time from threading import Thread th=Thread() class Answer(Thread): def run(self): a=input("What is your answer:") if a

Re: Multi-threading with a simple timer?

2018-07-03 Thread Michael Vilain
getch() function that can be setup with a halfdelay() timer. https://docs.python.org/3/howto/curses.html That's the closest I could find to getting input with a time-out from the terminal. If it's to kludgy, you'll have to roll your own OS-specific version. My guess is that

Re: Multi-threading with a simple timer?

2018-07-03 Thread Akkana Peck
David D wrote: > Is there a SIMPLE method that I can have a TIMER count down at a user input > prompt - if the user doesn't enter information within a 15 second period, it > times out. Does this do what you want? from threading import Timer import sys import os def run_later():

Re: Multi-threading with a simple timer?

2018-07-03 Thread David D
This works, but does not do exactly what I want. When the user enters in a correct answer, the program and threading stops. Any ideas on what I should change? import time from threading import Thread class Answer(Thread): def run(self): a=input("What is your answer:") if a=

Re: Multi-threading with a simple timer?

2018-07-03 Thread David D
This works, but does not do exactly what I want. What I want to happen is : when the user enters in a correct answer, the program and threading stops. Any ideas on what I should change? import time from threading import Thread class Answer(Thread): def run(self): a=input("What

Re: Multi-threading with a simple timer?

2018-07-03 Thread Chris Angelico
On Wed, Jul 4, 2018 at 12:05 AM, Marko Rauhamaa wrote: > Gregory Ewing : > >> Robin Becker wrote: >>> if I leave out the signal.signal(signal.SIGALRM,signal.SIG_IGN) then >>> the timeout function gets called anyway. >> >> Yes, it needs some more stuff around it to make it useful. Probably >> you a

Re: Multi-threading with a simple timer?

2018-07-03 Thread Michael Vilain
50-322-6755 > On 02-Jul-2018, at 11:12 PM 🌙, Gregory Ewing > wrote: > > David D wrote: >> Is there a SIMPLE method that I can have a TIMER count down at a user input >> prompt - if the user doesn't enter information within a 15 second period, it >> ti

Re: Multi-threading with a simple timer?

2018-07-03 Thread Marko Rauhamaa
Gregory Ewing : > Robin Becker wrote: >> if I leave out the signal.signal(signal.SIGALRM,signal.SIG_IGN) then >> the timeout function gets called anyway. > > Yes, it needs some more stuff around it to make it useful. Probably > you also want the signal handler to raise an exception and catch it >

Re: Multi-threading with a simple timer?

2018-07-03 Thread Gregory Ewing
Robin Becker wrote: if I leave out the signal.signal(signal.SIGALRM,signal.SIG_IGN) then the timeout function gets called anyway. Yes, it needs some more stuff around it to make it useful. Probably you also want the signal handler to raise an exception and catch it somewhere rather than exiting

Re: Multi-threading with a simple timer?

2018-07-03 Thread Robin Becker
On 03/07/2018 07:12, Gregory Ewing wrote: import signal, sys def timeout(*args): print("Too late!") sys.exit(0) signal.signal(signal.SIGALRM, timeout) signal.setitimer(signal.ITIMER_REAL, 15) data = input("Enter something: ") print("You entered: ", data) This doesn't work in windows

Re: Multi-threading with a simple timer?

2018-07-02 Thread Gregory Ewing
David D wrote: Is there a SIMPLE method that I can have a TIMER count down at a user input prompt - if the user doesn't enter information within a 15 second period, it times out. import signal, sys def timeout(*args): print("Too late!") sys.exit(0) signal.signal

Multi-threading with a simple timer?

2018-07-02 Thread David D
Is there a SIMPLE method that I can have a TIMER count down at a user input prompt - if the user doesn't enter information within a 15 second period, it times out. I am going to be using pycharm and not the shell. Thanks in advance. -- https://mail.python.org/mailman/listinfo/python-list

Re: Timer runs only once.

2016-11-30 Thread vnthmanoharan
On Wednesday, 30 November 2016 20:36:15 UTC+5:30, siva gnanam wrote: > On Wednesday, November 30, 2016 at 8:11:49 PM UTC+5:30, vnthma...@gmail.com > wrote: > > from threading import Timer > > > > class TestTimer: > > def foo(self):

Re: Timer runs only once.

2016-11-30 Thread Ian Kelly
On Wed, Nov 30, 2016 at 8:06 AM, siva gnanam wrote: > On Wednesday, November 30, 2016 at 8:11:49 PM UTC+5:30, vnthma...@gmail.com > wrote: >> from threading import Timer >> >> class TestTimer: >> def foo(self): >> print("hello world&quo

Re: Timer runs only once.

2016-11-30 Thread siva gnanam
On Wednesday, November 30, 2016 at 8:11:49 PM UTC+5:30, vnthma...@gmail.com wrote: > from threading import Timer > > class TestTimer: > def foo(self): > print("hello world") > self.startTimer() > > def startTimer(self): >

Re: Timer runs only once.

2016-11-30 Thread siva gnanam
On Wednesday, November 30, 2016 at 7:35:46 PM UTC+5:30, siva gnanam wrote: > The following program print hello world only once instead it has to print the > string for every 5 seconds. > > from threading import Timer; > > class TestTimer: > >

Timer runs only once.

2016-11-30 Thread vnthmanoharan
from threading import Timer class TestTimer: def foo(self): print("hello world") self.startTimer() def startTimer(self): self.t1 = Timer(5, self.foo) self.t1.start() timer = TestTimer() timer.startTimer() -- https://mail.python.org/mailma

Timer runs only once.

2016-11-30 Thread siva gnanam
The following program print hello world only once instead it has to print the string for every 5 seconds. from threading import Timer; class TestTimer: def __init__(self): self.t1 = Timer(5.0, self.foo); def startTimer(self): self.t1.start

threading - Doug Hellman stdlib book, Timer() subclassing etc

2016-02-16 Thread Veek. M
? Normally you'd have to call a function in pthreads (OS call) One can sort of figure that t.start() hides the actual OS call, but when we implement run().. somehow, magically there's no OS call? WTH! ?? Then in the Timer example in the next section, how is the whole delay/canecl bit impleme

Re: matplotlib timer

2015-10-01 Thread Laura Creighton
In a message of Thu, 01 Oct 2015 20:47:10 +0100, Dave Farrance writes: >Laura Creighton wrote: > >>In a message of Thu, 01 Oct 2015 20:03:26 +0100, Dave Farrance writes: >>>Laura Creighton wrote: >>> In a message of Thu, 01 Oct 2015 18:45:06 +0100, Dave Farrance writes: >Yet the documenta

Re: matplotlib timer

2015-10-01 Thread Dave Farrance
Laura Creighton wrote: >In a message of Thu, 01 Oct 2015 20:03:26 +0100, Dave Farrance writes: >>Laura Creighton wrote: >> >>>In a message of Thu, 01 Oct 2015 18:45:06 +0100, Dave Farrance writes: Yet the documentation says that it's mandatory for the GUI backend base to implement stop()

Re: matplotlib timer

2015-10-01 Thread Laura Creighton
In a message of Thu, 01 Oct 2015 20:03:26 +0100, Dave Farrance writes: >Laura Creighton wrote: > >>In a message of Thu, 01 Oct 2015 18:45:06 +0100, Dave Farrance writes: >>>Yet the documentation says that it's mandatory for the GUI backend base >>>to implement stop() but that single_shot is option

Re: matplotlib timer

2015-10-01 Thread Dave Farrance
Laura Creighton wrote: >In a message of Thu, 01 Oct 2015 18:45:06 +0100, Dave Farrance writes: >>Yet the documentation says that it's mandatory for the GUI backend base >>to implement stop() but that single_shot is optional. Ho hum. > >report as a bug. its a doc bug at least, but I think its a r

Re: matplotlib timer

2015-10-01 Thread Laura Creighton
In a message of Thu, 01 Oct 2015 18:45:06 +0100, Dave Farrance writes: >Yet the documentation says that it's mandatory for the GUI backend base >to implement stop() but that single_shot is optional. Ho hum. report as a bug. its a doc bug at least, but I think its a real bug, and your code should

Re: matplotlib timer

2015-10-01 Thread Dave Farrance
Laura Creighton wrote: >In a message of Thu, 01 Oct 2015 17:36:50 +0100, Dave Farrance writes: >>I'm trying to set up the basics of a timer-scheduled function in >>matplotlib and I can't figure out how to stop the timer. Maybe the >>stop() method is dysfunction

Re: matplotlib timer

2015-10-01 Thread Laura Creighton
In a message of Thu, 01 Oct 2015 17:36:50 +0100, Dave Farrance writes: >I'm trying to set up the basics of a timer-scheduled function in >matplotlib and I can't figure out how to stop the timer. Maybe the >stop() method is dysfunctional in Ubuntu 14.04 or maybe I'm getting

matplotlib timer

2015-10-01 Thread Dave Farrance
I'm trying to set up the basics of a timer-scheduled function in matplotlib and I can't figure out how to stop the timer. Maybe the stop() method is dysfunctional in Ubuntu 14.04 or maybe I'm getting the syntax wrong. If anybody's got matplotlib installed, can you try this co

Re: Python/C++ timer intermittent bug

2010-07-01 Thread Paul
threading using the Python/C API. I have an >> extension that implements a timer, and the C++ timer callback function >> calls a Python function. The relevant code looks like this: >> >> [snip] >> >> static void CALLBACK PeriodicTimer(UINT wTimerID, UINT ms

Re: Python/C++ timer intermittent bug

2010-07-01 Thread Thomas Jollans
On 06/30/2010 09:28 PM, p...@mail.python.org wrote: > I have a problem with threading using the Python/C API. I have an > extension that implements a timer, and the C++ timer callback function > calls a Python function. The relevant code looks like this: > > [snip] > >

Python/C++ timer intermittent bug

2010-06-30 Thread Paul
I have a problem with threading using the Python/C API. I have an extension that implements a timer, and the C++ timer callback function calls a Python function. The relevant code looks like this: static PyObject *timer_setmodname( PyObject *pSelf, PyObject *pArgs ) { char *b

Re: First Timer

2010-05-11 Thread Mensanator
On May 11, 9:32 pm, Terry Reedy wrote: > On 5/11/2010 7:03 PM, Mensanator wrote: > > > On May 11, 4:37 pm, Terry Reedy  wrote: > > >> In the command line interpreter, you should be able to hit up > >> arrow and have the line above copied to the current entry line for > >> correction. In IDLE, this

Re: First Timer

2010-05-11 Thread Terry Reedy
On 5/11/2010 7:03 PM, Mensanator wrote: On May 11, 4:37 pm, Terry Reedy wrote: In the command line interpreter, you should be able to hit up arrow and have the line above copied to the current entry line for correction. In IDLE, this does not yet work, It doesn't have to. Simply place the cu

Re: First Timer

2010-05-11 Thread Mensanator
On May 11, 4:37 pm, Terry Reedy wrote: > On 5/11/2010 3:28 PM, Donna Lane wrote: > > > I have downloaded Python and I'm a beginner in every sense. > > Welcome. I hope you enjoy Python too. > >  > What I want to> know now is when I am in Idle and have made a syntax error > how do I repair? > > Aft

Re: First Timer

2010-05-11 Thread Terry Reedy
On 5/11/2010 3:28 PM, Donna Lane wrote: I have downloaded Python and I'm a beginner in every sense. Welcome. I hope you enjoy Python too. > What I want to know now is when I am in Idle and have made a syntax error how do I repair? After the error I can't type in anything and I get this bing n

Re: First Timer

2010-05-11 Thread Chris Rebert
On Tue, May 11, 2010 at 12:28 PM, Donna Lane wrote: > I have downloaded Python and I'm a beginner in every sense.  What I want to > know now is when I am in Idle and have made a syntax error how do I repair? > After the error I can't type in > > anything and I get this bing noise.  Usually I just

First Timer

2010-05-11 Thread Donna Lane
I have downloaded Python and I'm a beginner in every sense. What I want to know now is when I am in Idle and have made a syntax error how do I repair? After the error I can't type in anything and I get this bing noise. Usually I just start idle over again. Thanks to anyone out there who respond

Re: Timer

2010-03-17 Thread Peter Otten
now attempted to use a timer, but this does not seem to run the > function at the end of the time. The code of my latest attempt: > > def next(self=None, testnum=10, testspeed=5): > self.count += 1 > #Sets label, telling the user the next word to memorise > self.nobtns.

Timer

2010-03-17 Thread Sam Bull
I'm writing a pyGTK program, and I need to display the contents of a window for a few seconds before automatically moving on. I have tried using the time.sleep method, but this has problems, such as the program becoming unresponsive. I have now attempted to use a timer, but this does not se

Re: Timer

2010-02-18 Thread Victor Subervi
On Wed, Feb 17, 2010 at 2:37 PM, Stephen Hansen wrote: > On Wed, Feb 17, 2010 at 10:14 AM, Victor Subervi > wrote: > >> Obviously, the removeCSS isn't going to work in that last line. What can I >> put there to remove the splash page after 5 seconds? >> > > Even though you're generating this with

Re: Timer

2010-02-17 Thread Stephen Hansen
On Wed, Feb 17, 2010 at 10:14 AM, Victor Subervi wrote: > Obviously, the removeCSS isn't going to work in that last line. What can I > put there to remove the splash page after 5 seconds? > Even though you're generating this with python, it doesn't have anything to do with Python. You'll have to

Re: Timer

2010-02-17 Thread Dotan Cohen
> What can I > put there to remove the splash page after 5 seconds? > Javascript. -- Dotan Cohen http://what-is-what.com http://gibberish.co.il Please CC me if you want to be sure that I read your message. I do not read all list mail. -- http://mail.python.org/mailman/listinfo/python-list

Re: Timer

2010-02-17 Thread Gabriel
; HEIGHT="%s" id="myMovieName">' % (str(wn*1008), str(wn*200)) >     print ''' > > > ''' >     print ' quality=high bgcolor=#FF WIDTH="%s" HEIGHT="%s" NAME="myMovieName" > ALIGN=&quo

Timer

2010-02-17 Thread Victor Subervi
7;' print 'http://www.macromedia.com/go/getflashplayer";>' % (str(wn*1008), str(wn*200)) print '' print '' Timer(5, removeCSS, ()).start() Obviously, the removeCSS isn't going to work in that last line. What can I put there to remove the

Re: timer for a function

2010-02-11 Thread Aahz
;The timeout in the options regards only a socket timeout, not further >stages of connection negotiation, so it doesn't work there. Does paramiko offer any kind of callback? In a similar situation with pycurl, I built my own timer into a callback. -- Aahz (a...@pythoncraft.com) <

Re: timer for a function

2010-02-09 Thread mk
Stephen Hansen wrote: Question: how can I do that? Use another threaded class? Is there some other way? First of all, thanks for answer! What OS? Does this have to be OS-independant? Err, sorry -- this is Linux/UNIX only. Are you using more then one transport/SSLClient in your pro

Re: timer for a function

2010-02-08 Thread Stephen Hansen
On Fri, Feb 5, 2010 at 9:23 AM, mk wrote: > On paramiko mailing list I got the suggestion to build a timer and then > quit this by myself: > > The timeout option in connect() is for the socket, not for the entire >> operation. You are connected, so that timeout is no longe

Re: timer for a function

2010-02-08 Thread Steven D'Aprano
On Fri, 05 Feb 2010 18:23:09 +0100, mk wrote: [...] > On paramiko mailing list I got the suggestion to build a timer and then > quit this by myself: > >> The timeout option in connect() is for the socket, not for the entire >> operation. You are connected, so that timeout

timer for a function

2010-02-05 Thread mk
regards only a socket timeout, not further stages of connection negotiation, so it doesn't work there. On paramiko mailing list I got the suggestion to build a timer and then quit this by myself: The timeout option in connect() is for the socket, not for the entire operation. You are conn

Re: Sleep timer but still responsive?

2010-01-30 Thread Dave Angel
? A curses-based interfase? -- Gabriel Genellina My app is purely console based. I just don't want the console to lock up (on Windows using time.sleep(x) causes the console to become unresponsive until the timer is done), and I want people to be able to CTRL+C to stop the sc

Re: Sleep timer but still responsive?

2010-01-29 Thread JohnnyFive
; > > Do you have a GUI? A curses-based interfase? > > > > -- > > > Gabriel Genellina > > > My app is purely console based. I just don't want the console to lock > > up (on Windows using time.sleep(x) causes the console to become > > unresponsive unt

Re: Sleep timer but still responsive?

2010-01-29 Thread Gabriel Genellina
En Fri, 29 Jan 2010 14:39:31 -0300, MRAB escribió: JohnnyFive wrote: My app is purely console based. I just don't want the console to lock up (on Windows using time.sleep(x) causes the console to become unresponsive until the timer is done), and I want people to be able to CTRL+C to

RE: Sleep timer but still responsive?

2010-01-29 Thread Andreas Tawn
t; -- > > Gabriel Genellina > > My app is purely console based. I just don't want the console to lock > up (on Windows using time.sleep(x) causes the console to become > unresponsive until the timer is done), and I want people to be able to > CTRL+C to stop the script if nee

Re: Sleep timer but still responsive?

2010-01-29 Thread MRAB
ly console based. I just don't want the console to lock up (on Windows using time.sleep(x) causes the console to become unresponsive until the timer is done), and I want people to be able to CTRL+C to stop the script if need be (which can't be done if it's unresponsive!). Thanks. Which

Re: Sleep timer but still responsive?

2010-01-29 Thread JohnnyFive
purely console based. I just don't want the console to lock up (on Windows using time.sleep(x) causes the console to become unresponsive until the timer is done), and I want people to be able to CTRL+C to stop the script if need be (which can't be done if it's unresponsive!). Thanks.

Re: Sleep timer but still responsive?

2010-01-28 Thread Gabriel Genellina
En Thu, 28 Jan 2010 20:34:22 -0300, JohnnyFive escribió: I need help with something that is probably fairly simple, but i'm having a heck of a time getting it work. Basically, I need my program to sleep for a certain amount of time, but I don't want the console to become unresponsive while s

Sleep timer but still responsive?

2010-01-28 Thread JohnnyFive
in program to run it's course again. I tried using a Timer, threads, etc, but I really can't figure it out. What am I missing? I can post what I have, but I don't want to get caught up on how i'm doing it wrong (as none of it works), but rather the correct way to do it

Re: How to run a repeating timer every n minutes?

2009-10-30 Thread Frank Millman
data from the main >> thread without lock? > > stop() is part of the Timer-interface, and tas it's not mentioned to be > unsafe in the docs you can just call it. It might be that it internally > calls some threadsafe means of communication (Event, Lock). > Thought I sh

Re: How to run a repeating timer every n minutes?

2009-10-29 Thread Diez B. Roggisch
mk wrote: > Frank Millman wrote: > >> class Timer(threading.Thread): >> def __init__(self): >> threading.Thread.__init__(self) >> self.event = threading.Event() >> >> def run(self): >> while not self.event.is_set()

Re: How to run a repeating timer every n minutes?

2009-10-29 Thread mk
Frank Millman wrote: class Timer(threading.Thread): def __init__(self): threading.Thread.__init__(self) self.event = threading.Event() def run(self): while not self.event.is_set(): """ The things I wan

RE: How to run a repeating timer every n minutes?

2009-10-29 Thread VYAS ASHISH M-NTB837
repeating timer every n minutes? Ashish Vyas wrote: > Dear All > > How do I write a code that gets executed 'every x' minutes? > [...] > Regards, > Ashish Vyas Here is one way - import threading class Timer(threading.Thread): def __init__(self): th

Re: How to run a repeating timer every n minutes?

2009-10-29 Thread Frank Millman
Ashish Vyas wrote: > Dear All > > How do I write a code that gets executed 'every x' minutes? > [...] > Regards, > Ashish Vyas Here is one way - import threading class Timer(threading.Thread): def __init__(self): threading.Thread.__ini

Re: How to run a repeating timer every n minutes?

2009-10-29 Thread Martin P. Hellwig
VYAS ASHISH M-NTB837 wrote: You might want to start a thread with a continues loop that primarily sleeps (time.sleep) but wakes up at regular intervals and executes what needs to be. -- MPH http://blog.dcuktec.com 'If consumed, best digested with added seasoning to own preference.' -- http://

Re: How to run a repeating timer every n minutes?

2009-10-29 Thread Wesley Brooks
I use the wx.Timer for this: import wx timer = wx.Timer(self, -1) # update gui every 1/4 second (250ms) timer.Start(250) Bind(wx.EVT_TIMER, OnUpdateValues) In the above I'm running the OnUpdateValues function every 250ms. Regards, Wesley Brooks 2009/10/29 VYAS ASHISH M-NTB837 > &g

How to run a repeating timer every n minutes?

2009-10-29 Thread VYAS ASHISH M-NTB837
Dear All How do I write a code that gets executed 'every x' minutes? I know how to do it 'after x' minutes, I do the following: def doAtTimerFire(): """ The things I want to do 'after x' minutes go here. """ And then from main code, I do this: tmr = threading.Timer(timeInSeconds,

Re: Place the timer in Python script

2009-09-18 Thread Dave Angel
Vamsikrishna wrote: How to place the timer in python code. I want calculate the python script execution time. ex : Start Timer : End Timer Execution Time : End Timer - Start Timer. How can we write the python code for this. Help would be appreciable. Thanks in Advance. Vamsi

Re: Place the timer in Python script

2009-09-18 Thread Avell Diroll
Vamsikrishna wrote: How to place the timer in python code. timeit ... it's in the standard library: http://docs.python.org/library/timeit.html Cheers, Ju -- Whomever controls the press, owns history -- Johann Gutenberg -- http://mail.python.org/mailman/listinfo/python-list

Place the timer in Python script

2009-09-18 Thread Vamsikrishna
How to place the timer in python code. I want calculate the python script execution time. ex : Start Timer : End Timer Execution Time : End Timer - Start Timer. How can we write the python code for this. Help would be appreciable. Thanks in Advance. Vamsi -- http://mail.python.org

Re: timer

2009-06-30 Thread Paul Moore
2009/6/30 superpollo : > Paul Moore wrote: >> >> 2009/6/30 superpollo : >> >>> Paul Moore wrote: >>> >>>> For a non-toy example, you'd probably create an Event object, use your >>>> timer to set the event, and your while lo

Re: timer

2009-06-30 Thread superpollo
i would like to thank each and everyone for help given, and aplologise for my inaccuracy. thanks 10**3! superchicken -- http://mail.python.org/mailman/listinfo/python-list

Re: timer

2009-06-30 Thread superpollo
Paul Moore wrote: 2009/6/30 superpollo : Paul Moore wrote: For a non-toy example, you'd probably create an Event object, use your timer to set the event, and your while loop would do while event.is_set(), so the problem wouldn't arise. thank u paul. if u dont mind, would you give

Re: timer

2009-06-30 Thread Paul Rudin
superpollo writes: > so why this does not work? > > 1 #!/usr/bin/python > 2 > 3 import threading > 4 > 5 e = threading.Event() > 6 t = threading.Timer(3.0, e.set()) The second arg needs to be a callable - maybe you meant e.set without the brackets? -- http:

Re: timer

2009-06-30 Thread superpollo
Paul Moore wrote: 2009/6/30 superpollo : Paul Moore wrote: For a non-toy example, you'd probably create an Event object, use your timer to set the event, and your while loop would do while event.is_set(), so the problem wouldn't arise. thank u paul. if u dont mind, would you give

Re: timer

2009-06-30 Thread Tim Golden
it should, shouldn't it?), then exits after 3 sec but with error: Nice try, but you're passing *the result of calling e.set* as the function parameter to Timer. And the result of calling e.set () is None. So you're passing None as the function-to-call. Which it does. And then.

Re: timer

2009-06-30 Thread superpollo
, sys.exit) 7 t.start() 8 while True: 9 print "stuff ", The Timer runs the function in another thread. Perhaps sys.exit is just exiting that thread and not the main thread. sys.exit raises a SystemExit exception, which will get handled in the new thread (where it won'

Re: timer

2009-06-30 Thread Paul Moore
2009/6/30 superpollo : > Paul Moore wrote: >> For a non-toy example, you'd probably create an Event object, use your >> timer to set the event, and your while loop would do while >> event.is_set(), so the problem wouldn't arise. > > thank u paul. if u dont mi

Re: timer

2009-06-30 Thread superpollo
, sys.exit) 7 t.start() 8 while True: 9 print "stuff ", The Timer runs the function in another thread. Perhaps sys.exit is just exiting that thread and not the main thread. sys.exit raises a SystemExit exception, which will get handled in the new thread (where it won'

Re: timer

2009-06-29 Thread Paul Moore
eading >>      4 import sys >>      5 >>      6 t = threading.Timer(3.0, sys.exit) >>      7 t.start() >>      8 while True: >>      9     print "stuff ", >> > The Timer runs the function in another thread. Perhaps sys.exit is just > exiting

Re: timer

2009-06-29 Thread MRAB
() 8 while True: 9 print "stuff ", The Timer runs the function in another thread. Perhaps sys.exit is just exiting that thread and not the main thread. -- http://mail.python.org/mailman/listinfo/python-list

timer

2009-06-29 Thread superpollo
hi folks. the follwing shoud print 'stuff' for 3 seconds and then stop. why it does not work? (prints stuff forever) 1 #!/usr/bin/python 2 3 import threading 4 import sys 5 6 t = threading.Timer(3.0, sys.exit) 7 t.start() 8 while True: 9

Re: PythonCard timer/thread tutorial

2008-12-25 Thread Mike Driscoll
On Dec 25, 7:24 am, Steven D'Aprano wrote: > On Wed, 24 Dec 2008 16:59:23 -0800, Mike Driscoll wrote: > >> Among my questions are: > >> """ A little thread we've added""" seems to be an isolated string. It > >> does not seem to be doing anything there, almost like a comment. Why is > >> it there?

Re: PythonCard timer/thread tutorial

2008-12-25 Thread Steven D'Aprano
On Wed, 24 Dec 2008 16:59:23 -0800, Mike Driscoll wrote: >> Among my questions are: >> """ A little thread we've added""" seems to be an isolated string. It >> does not seem to be doing anything there, almost like a comment. Why is >> it there? > > > That's what some people call a doc string.

Re: PythonCard timer/thread tutorial

2008-12-24 Thread Gabriel Genellina
En Wed, 24 Dec 2008 20:56:45 -0200, Sponge Nebson escribió: This is my first post. Nice to meet you all! Could one of you walk me through this code? It is from David McNab and Alex Tweedly's tutorial on timers and threads, which can be found here: Mike Driscoll has already answered your quest

Re: PythonCard timer/thread tutorial

2008-12-24 Thread Mike Driscoll
On Dec 24, 4:56 pm, Sponge Nebson wrote: > Hello all, > > This is my first post. Nice to meet you all! Could one of you walk me > through this code? > >    def myThread(*argtuple): >         """ >         A little thread we've added >         """ >         print "myThread: entered" >         q = a

PythonCard timer/thread tutorial

2008-12-24 Thread Sponge Nebson
Hello all, This is my first post. Nice to meet you all! Could one of you walk me through this code? def myThread(*argtuple): """ A little thread we've added """ print "myThread: entered" q = argtuple[0] print "myThread: starting loop" x =

Re: How to get high precision timer in python?

2008-10-29 Thread Steve Holden
甜瓜 wrote: > ^_^ Oh! I did not read the document for time.clock before, > and supposed it was same with time.time(). > > Thank you very much. > If you are using wxPython then you should probably see whether a wxTimer would meet your needs. regards Steve -- Steve Holden+1 571 484 6266

Re: How to get high precision timer in python?

2008-10-29 Thread James Mills
On Wed, Oct 29, 2008 at 4:22 PM, Tim Roberts <[EMAIL PROTECTED]> wrote: > I'm not sure you understood what he was saying. time.time() and > time.clock() can both be used for elapsed timing, but because of a fluke of > implementation, time.time() is more precise on Linux, and time.clock() is > more

Re: How to get high precision timer in python?

2008-10-28 Thread Tim Roberts
"" <[EMAIL PROTECTED]> wrote: >2008/10/29 James Mills <[EMAIL PROTECTED]>: >> On Wed, Oct 29, 2008 at 12:14 PM, <[EMAIL PROTECTED]> wrote: >>> I use python2.5 in WindowsXP. If using time.time() as timer, it seems >> >> On t

Re: How to get high precision timer in python?

2008-10-28 Thread 甜瓜
^_^ Oh! I did not read the document for time.clock before, and supposed it was same with time.time(). Thank you very much. ShenLei -- http://mail.python.org/mailman/listinfo/python-list

Re: How to get high precision timer in python?

2008-10-28 Thread James Mills
2008/10/29 甜瓜 <[EMAIL PROTECTED]>: > 2008/10/29 James Mills <[EMAIL PROTECTED]>: >> On Wed, Oct 29, 2008 at 12:14 PM, 甜瓜 <[EMAIL PROTECTED]> wrote: >>> I use python2.5 in WindowsXP. If using time.time() as timer, it seems >> >> On the win32 p

Re: How to get high precision timer in python?

2008-10-28 Thread 甜瓜
2008/10/29 James Mills <[EMAIL PROTECTED]>: > On Wed, Oct 29, 2008 at 12:14 PM, 甜瓜 <[EMAIL PROTECTED]> wrote: >> I use python2.5 in WindowsXP. If using time.time() as timer, it seems > > On the win32 platform should you not > be using time.clock vs. time.time

Re: How to get high precision timer in python?

2008-10-28 Thread James Mills
On Wed, Oct 29, 2008 at 12:14 PM, 甜瓜 <[EMAIL PROTECTED]> wrote: > I use python2.5 in WindowsXP. If using time.time() as timer, it seems On the win32 platform should you not be using time.clock vs. time.time ? --JamesMills -- -- -- "Problems are solved by method" -- htt

How to get high precision timer in python?

2008-10-28 Thread 甜瓜
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, in my project, I have to get timer percision up to 1ms. What should I do? Do I have to call Win32 API

Re: Using Timer or Scheduler in a Class

2008-08-13 Thread Steven D'Aprano
Hi Justin, Does Professor Battersea know you're using his gmail account? *wink* On Wed, 13 Aug 2008 23:16:12 -0400, Prof. William Battersea wrote: > I'd like a class method to fire every n seconds. > > I tried this: > > class Timed: > def.__init__(self)

Re: Using Timer or Scheduler in a Class

2008-08-13 Thread Rob Weir
On 14 Aug 2008, William Battersea wrote: > Both run once and end. I'm obviously missing something here. 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 better solution. Or http://www.gossamer-t

Using Timer or Scheduler in a Class

2008-08-13 Thread Prof. William Battersea
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() def.dothing(self): print "Doing Thing" s = new Timed() s.start() And: class Sch

Re: How to create a timer/scheduler in Python?

2008-07-12 Thread MrJean1
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 accu

Re: How to create a timer/scheduler in Python?

2008-07-12 Thread Daniel Fetchinson
> 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 se

  1   2   >