import time
s = time.time() + 30
running = True
while running:
if time.time() == s:
print 'yes'
running = False
This stops the loop after 30s but the program uses about 12% cpu. What
would be a more efficient way to do this? (p.s. i'm on python 2.7.3)
Saad
On 25/11/12 03:16, Nathan wrote:
What I'm trying to do now is add support for the card images. the
problem is, the program supports multiple types of spreads (two, so far,
are selectable), and they use different numbers of cards. It looks like
I need a variable number of widgets to display
On 25/11/12 19:50, Saad Javed wrote:
import time
s = time.time() + 30
running = True
while running:
if time.time() == s:
print 'yes'
running = False
This stops the loop after 30s but the program uses about 12% cpu. What
would be a more efficient way to do this? (p.s. i'm on python 2.7.3)
time.sleep(30) will pause the program for 30s. I want to the run the
program for 30s.
Saad
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
I'm working on a python script that runs on a Raspberry Pi. The script
detects when hardware buttons are pressed, and then runs functions based on
that input.
I want to be able to always listen for a button press, no matter what the
script is doing at the current moment. When a button press is
import time
running = True
while running:
print 'yes'
time.sleep(10)
This will print 'yes' after every 10s. I want to print 'yes' for 10s, then
quit.
Saad
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
On 25/11/12 22:01, Saad Javed wrote:
time.sleep(30) will pause the program for 30s. I want to the run the
program for 30s.
Your first email did not make that clear. Please take more care to
explain your question.
stop = time.time() + 30
while time.time() stop:
do_something_useful()
Saad Javed wrote:
import time
running = True
while running:
print 'yes'
time.sleep(10)
This will print 'yes' after every 10s. I want to print 'yes' for 10s, then
quit.
Then combine the two techniques, the busy waiting loop with sleeping for a
shorter amount of time:
import
On 25/11/12 22:06, Sean Carolan wrote:
I'm working on a python script that runs on a Raspberry Pi. The script
detects when hardware buttons are pressed, and then runs functions based on
that input.
I want to be able to always listen for a button press, no matter what the
script is doing at the
On 25/11/12 22:06, Sean Carolan wrote:
I'm working on a python script that runs on a Raspberry Pi. The script
detects when hardware buttons are pressed, and then runs functions based on
that input.
Oh I'm sorry, I completely misread what you wrote there. I didn't realise you
were talking
If you show us how you check whether the button is pressed, we may be able to
show you how to run that asynchronously.
Apologies for the previous email; I think I sent it in HTML format.
Gmail changed their user interface again...
This is how I'm checking for a button press:
modes = (weather,
On Sun, Nov 25, 2012 at 7:32 AM, Sean Carolan scaro...@gmail.com wrote:
This is how I'm checking for a button press:
This should really be done with interrupts, but unfortunately there is
no support in the RPi.GPIO module for that, even if you have a patched
kernel.
I've done a workshop earlier
On Sun, Nov 25, 2012 at 7:29 AM, Francois Dion francois.d...@gmail.com wrote:
This should really be done with interrupts, but unfortunately there is
no support in the RPi.GPIO module for that, even if you have a patched
kernel.
Thank you for all this great information. I ended up going with a
CC'ing the list...
I know you can use images instead of text with Labels, like you can with
Buttons.
The advantage of a Text widget, in this case, is that you can use both in the
same widget.
That way, I don't need to worry about how widgets are displayed, shuffled
around, and
undisplayed
On Nov 25, 2012 6:49 PM, ALAN GAULD alan.ga...@btinternet.com wrote:
CC'ing the list...
Oops, my bad. I forget to hit Reply All.
I know you can use images instead of text with Labels, like you can with
Buttons.
The advantage of a Text widget, in this case, is that you can use both
in the
15 matches
Mail list logo