Python

running a clock and triggerirng a function

Page 1 of 1

4 Replies - 827 Views - Last Post: 10 February 2010 - 06:20 PM Rate Topic: -----

#1 sparls   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 10-February 10

Python

Posted 10 February 2010 - 01:12 PM

Hi,
I am new to python and would like to implement following:

constantly running a clock and trigger an other function for every 5 seconds.

Please give me idea how to do this.

Thanks a bunch
Is This A Good Question/Topic? 0
  • +

Replies To: Python

#2 zombie_chan51   User is offline

  • D.I.C Regular

Reputation: 7
  • View blog
  • Posts: 327
  • Joined: 16-March 08

Re: Python

Posted 10 February 2010 - 03:43 PM

import time

time.sleep(5)
Was This Post Helpful? 0
  • +
  • -

#3 sparls   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 10-February 10

Re: Python

Posted 10 February 2010 - 04:55 PM

View Postzombie_chan51, on 10 February 2010 - 02:43 PM, said:

import time

time.sleep(5)


Thanks, how do I keep this in a loop. say if I wanted to print my name for every 5 seconds.
Was This Post Helpful? 0
  • +
  • -

#4 zombie_chan51   User is offline

  • D.I.C Regular

Reputation: 7
  • View blog
  • Posts: 327
  • Joined: 16-March 08

Re: Python

Posted 10 February 2010 - 05:53 PM

import time

while True:
    print name
    time.sleep(5)


Was This Post Helpful? 0
  • +
  • -

#5 sparls   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 10-February 10

Re: Python

Posted 10 February 2010 - 06:20 PM

View Postsparls, on 10 February 2010 - 03:55 PM, said:

View Postzombie_chan51, on 10 February 2010 - 02:43 PM, said:

import time

time.sleep(5)


Thanks, how do I keep this in a loop. say if I wanted to print my name for every 5 seconds.



Thank you very much.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1