Synchronizing a sound with a widget change

Yimr Zero yimr00 at gmail.com
Thu Nov 13 09:34:52 EST 2014


Hi,

You may try to add the sleep(5) after the color change statement. You could adjust the sleep time to let the color change and beep synchroize.

Thanks.



Yimr Zero
 
From: ast
Date: 2014-11-13 18:50
To: python-list
Subject: Synchronizing a sound with a widget change
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
 
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20141113/c37833dc/attachment.html>


More information about the Python-list mailing list