Question

I rewriting a simple midi music sequencer from javascript into Python as a way of teaching myself Python.

I'm ready to begin working with time (for fireing midi events) but I can't find any good resources for executing scripts in time, scheduling timing events, etc.

A few things I've read suggest I should use a module like tkinter, but I would rather have all the timing mechanisms independent of any gui module.

Does anyone have any suggestions/resources for working with time?

Was it helpful?

Solution

For executing scripts in a certain interval (of course within another script), you might want to take a look at the time module (Documentation here).

But if you are planning to use timing with a GUI, you might want to have concurrent threading or processing so that there is not delay with the user interface. In such case you can use multithreading (Documentation) or multiprocessing (Documentation) modules.

As a final note, some GUI frameworks come with built-in threading support, so you might want to take a look at that. For example, PyQT4 has something called QThread which handles all thread/event manipulation.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top