Using Python's threading module in MIDI Remote Scripts ?

UHE is now closed. For Technical Support from Ableton, please go here: http://www.ableton.com/support
Locked
SBRK
Posts: 81
Joined: Tue Feb 08, 2011 3:26 pm
Location: Paris, France
Contact:

Using Python's threading module in MIDI Remote Scripts ?

Post by SBRK » Mon Dec 19, 2011 3:04 am

I'm customizing a python midi remote script for my nanoKontrol2 and would like to have the leds of a track to flash for a few miliseconds when the selected track changes. I managed to do so with a time.sleep but it has a major drawback : it is a blocking function and during these few miliseconds, it blocks the midi script. What would be ideal would be a threading.timer, but apparently threading is not available (I'm on Windows 7 64 bits, if it changes anything).
Is there a way to use it, or is there another way to achieve what I want to do ?

tldr: how can I use the python threading module in Ableton Live MIDI Remote Scripts, in order to have a non-blocking timer ?

Thanks

SBRK
Posts: 81
Joined: Tue Feb 08, 2011 3:26 pm
Location: Paris, France
Contact:

Re: Using Python's threading module in MIDI Remote Scripts ?

Post by SBRK » Mon Dec 19, 2011 3:50 am

Well I found a way...
There is a timer that can call callback functions every 100ms in the scripts. There was already an "on_timer" function in the file I was editing so I just had to add some code in there and voila.

Locked