Synchronizing a sound with a widget change

ast nomail at invalid.com
Thu Nov 13 05:50:34 EST 2014


Hello, here is a small test code:

----------------
from tkinter import Tk, Frame
from winsound import Beep

root = Tk()

f = Frame(root, width=300, height=300)
f.pack()

f.config(bg='Yellow')
Beep(2000, 1000)
--------------

I intended to change the frame color to yellow (f.config(bg='Yellow'))
and at the same time to emit a sound (Beep(2000, 1000))

But I first have the sound and when the sound is over the window appears.

Is there a way to fix that ?

I have the idea to run an other thread to emit the sound, but I didn't try yet.
Is it the solution ?

Thanks





More information about the Python-list mailing list