I'm new to Python and I'm writing a script thatincludes some timed routines. My current approach is to instantiate a classthat includes those Timers (from: threading.Timer),but I don't want the script to return when it gets to theend of the function:
import mytimertimer = mytimer()
Suppose I have a imple script like that one. All itdoes is instantiate a mytimer object which performs a seriesof timed activities.
In order for the application not to exit, I could use Qt like this:
from PyQt4.QtCore import QCoreApplicationimport mytimerimport sysdef main(): app = QCoreApplication(sys.argv) timer = mytimer() sys.exit(app.exec_())if __name__ == '__main__': main()
This way, the sys.exit() call won't return immediately, and the timer would just keep doing its thing 'forever' in background.
Although this is a solution I've used before, using Qt just for this doesn'tfell right to me.So my question is, Is there any way to accomplish this using standard Python?
Thanks