4 Replies - 1430 Views - Last Post: 13 December 2012 - 11:15 AM Rate Topic: -----

#1 fledgeling  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 69
  • Joined: 10-October 12

a timmer ?

Posted 13 December 2012 - 07:22 AM

Hello everyone, i want to have in my program something that will count some random amount of time for example between 10 and 20 minutes and once this time is over to stop the curent flow of the program and execute some other lines of code, is that possible ? is there any library for that ? I am not asking the code just some baselines ^^
Also a widget-like clock that will start and stop with specific comands would be useful

Thanks in advance :)

Is This A Good Question/Topic? 0
  • +

Replies To: a timmer ?

#2 Nallo  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 163
  • View blog
  • Posts: 255
  • Joined: 19-July 09

Re: a timmer ?

Posted 13 December 2012 - 10:41 AM

Basically you need multiprocessing/multithreading for that. After all your timer and "parts of your program" have to run at the same time.

I don't think there is a simple to use general module for that. Judging from other questions you asked on this board I assume you are a beginner. And then you are likely in over your head with that. A general module doing what you asked for would need to handle concurrency issues, shared states, locks, stopping threads in a save way and more. It is not simple stuff (that is why I think there is no simple general module)

If you are not intimidated you may look at pythons threading, os, multithreading and signal modules.
Was This Post Helpful? 0
  • +
  • -

#3 fledgeling  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 69
  • Joined: 10-October 12

Re: a timmer ?

Posted 13 December 2012 - 10:55 AM

View PostNallo, on 13 December 2012 - 10:41 AM, said:

Basically you need multiprocessing/multithreading for that. After all your timer and "parts of your program" have to run at the same time.

I don't think there is a simple to use general module for that. Judging from other questions you asked on this board I assume you are a beginner. And then you are likely in over your head with that. A general module doing what you asked for would need to handle concurrency issues, shared states, locks, stopping threads in a save way and more. It is not simple stuff (that is why I think there is no simple general module)

If you are not intimidated you may look at pythons threading, os, multithreading and signal modules.

I guess i do am intimidated once all i know about os is to handle txt files and zip them ://>
Thanks for the reply


Oh by the way, is there any way to count the time that the algorithm runs ?

This post has been edited by fledgeling: 13 December 2012 - 10:58 AM

Was This Post Helpful? 0
  • +
  • -

#4 Nallo  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 163
  • View blog
  • Posts: 255
  • Joined: 19-July 09

Re: a timmer ?

Posted 13 December 2012 - 11:06 AM

If you want to measure time of a program that finishes its execution you may want to look at two tutorials here at dreamincode: calculating-the-runtime-of-a-function and timeit-module
Was This Post Helpful? 0
  • +
  • -

#5 fledgeling  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 69
  • Joined: 10-October 12

Re: a timmer ?

Posted 13 December 2012 - 11:15 AM

View PostNallo, on 13 December 2012 - 11:06 AM, said:

If you want to measure time of a program that finishes its execution you may want to look at two tutorials here at dreamincode: calculating-the-runtime-of-a-function and timeit-module

thanks
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1