6 Replies - 1003 Views - Last Post: 11 July 2012 - 08:17 PM Rate Topic: -----

#1 eugenerator  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 12
  • Joined: 22-June 12

Is there some sort of "wait" function built into python?

Posted 27 June 2012 - 05:02 PM

My current project is a Brain Training Program, and one of the activities is a memory game. The idea is for the program to show the user a string of numbers for a certain period of time (like 10 seconds), hide the numbers in some way (I'll probably just make it scroll down several lines for now), and ask the user to enter what they just saw.

But..I don't know how to make the program pause for l0 seconds. Are there any functions that all you to do this?

Thanks!

Is This A Good Question/Topic? 0
  • +

Replies To: Is there some sort of "wait" function built into python?

#2 jon.kiparsky  Icon User is offline

  • Pancakes!
  • member icon


Reputation: 7578
  • View blog
  • Posts: 12,745
  • Joined: 19-March 11

Re: Is there some sort of "wait" function built into python?

Posted 27 June 2012 - 05:06 PM

I seldom like to do this, but searching for python pause seconds does bring up some suggestive results.
This one seems pretty handy.

This post has been edited by jon.kiparsky: 27 June 2012 - 05:07 PM

Was This Post Helpful? 1
  • +
  • -

#3 eugenerator  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 12
  • Joined: 22-June 12

Re: Is there some sort of "wait" function built into python?

Posted 27 June 2012 - 05:27 PM

Oh, okay, thanks. I found what I was looking for. Sorry for the trivial question. I just didn't know what to search for..

Why do you "seldom like to do this"? Is using 'sleep' unconventional or sloppy in some way?
Was This Post Helpful? 0
  • +
  • -

#4 jon.kiparsky  Icon User is offline

  • Pancakes!
  • member icon


Reputation: 7578
  • View blog
  • Posts: 12,745
  • Joined: 19-March 11

Re: Is there some sort of "wait" function built into python?

Posted 27 June 2012 - 05:31 PM

Oh, no, not that - I meant I don't like "google it" as a reply, generally. But as it happened I didn't know this one off the top of my head, and that's how I found my way to it.
Was This Post Helpful? 0
  • +
  • -

#5 Akelo  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 98
  • Joined: 12-December 07

Re: Is there some sort of "wait" function built into python?

Posted 27 June 2012 - 08:20 PM

Unused by many is the ctypes module. You could use the c call 'system("Pause")' for a full halt if that's what you wanted...or build your own timer class that monitored the system time for 10 seconds to pass :).
Was This Post Helpful? 0
  • +
  • -

#6 sepp2k  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2091
  • View blog
  • Posts: 3,185
  • Joined: 21-June 11

Re: Is there some sort of "wait" function built into python?

Posted 28 June 2012 - 01:01 AM

View PostAkelo, on 28 June 2012 - 05:20 AM, said:

You could use the c call 'system("Pause")' for a full halt if that's what you wanted...


Except that that only works on Windows. There's no reason to artificially make your scripts single-platform if you don't have to.


Quote

or build your own timer class that monitored the system time for 10 seconds to pass :).


Why would he do that if he can just use time.sleep?
Was This Post Helpful? 2
  • +
  • -

#7 k3y  Icon User is offline

  • D.I.C Head

Reputation: 36
  • View blog
  • Posts: 205
  • Joined: 25-February 12

Re: Is there some sort of "wait" function built into python?

Posted 11 July 2012 - 08:17 PM

View Posteugenerator, on 27 June 2012 - 07:02 PM, said:

My current project is a Brain Training Program, and one of the activities is a memory game. The idea is for the program to show the user a string of numbers for a certain period of time (like 10 seconds), hide the numbers in some way (I'll probably just make it scroll down several lines for now), and ask the user to enter what they just saw.

But..I don't know how to make the program pause for l0 seconds. Are there any functions that all you to do this?

Thanks!


Maybe this will help?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1