Synchronizing a sound with a widget change
Dave Angel
davea at davea.name
Thu Nov 13 06:42:55 EST 2014
"ast" <nomail at invalid.com> Wrote in message:
>
> "ast" <nomail at invalid.com> a écrit dans le message de news:54648e75$0$12771$426a74cc at news.free.fr...
>>
>> "ast" <nomail at invalid.com> a écrit dans le message de
>> news:54648d03$0$1981$426a74cc at news.free.fr...
>>
>>>
>>> I have the idea to run an other thread to emit the sound, but I didn't try yet.
>>> Is it the solution ?
>>>
>>
>> nope, still doesn't work !
>>
>
>> root.after(1, mybeep)
>
>
> with:
>
> f = Frame(root, width=300, height=300)
> f.pack()
> f.config(bg='Yellow')
> root.after(80, mybeep)
>
> it works and with:
>
> f = Frame(root, width=300, height=300)
> f.pack()
> f.config(bg='Yellow')
> root.after(60, mybeep)
>
> it doesn't work
>
> I understand that Python takes times to create the root
> window and to color the frame. It the sound arrives
> before the end of the drawing, Python goes to the sound
> emitting,and when finished it goes back to drawing.
>
> This is annoying
> I would like sometuhing stable if possible
>
I don't use Windows, but from what I read, winsound.Beep is a
blocking call, and therefore must not be used in the main thread
of a gui environment.
Once the function is called, no events are
processed.
It seems like you need winsound.SND_ASYNC
--
DaveA
More information about the Python-list
mailing list