Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.025 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'yet.': 0.04; 'root': 0.05; 'tkinter': 0.07; 'thread': 0.14; 'appears.': 0.16; 'ast': 0.16; 'emit': 0.16; 'sound,': 0.16; 'statement.': 0.16; 'tk()': 0.16; 'fix': 0.17; 'widget': 0.19; 'thanks.': 0.20; 'import': 0.22; 'cc:2**0': 0.24; 'code:': 0.26; 'idea': 0.28; 'skip:( 20': 0.30; 'run': 0.32; 'to:name:python-list': 0.33; 'date:': 0.34; 'could': 0.34; 'subject:with': 0.35; 'test': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'there': 0.35; 'adjust': 0.36; "didn't": 0.36; 'thanks': 0.36; 'hi,': 0.36; 'message- id:@gmail.com': 0.38; 'window': 0.38; 'to:addr:python-list': 0.38; 'skip:- 10': 0.38; 'subject:': 0.39; 'to:addr:python.org': 0.39; 'color': 0.61; 'first': 0.61; 'here': 0.66; 'sound': 0.68; 'received:111': 0.84; 'subject:skip:S 10': 0.84; 'yellow': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:references:mime-version:message-id :content-type; bh=/EdfQZprC0GRXSTC2PWHcPl/vtIp7vPVlCyEHgOJAow=; b=Pmo4Evvl+vA9dBgcrWerPtVz2eYqZ6kwjB2lNQSZ+vfNvEsQ5PpIf3C54lD2eXyO+0 FzxXLQPqMuYy2hdD796Z5XlBzki6hM1nxlz8pQBBOHdvLD711SzVgOq5YMSyCQp0upRz BdddITygd0TEOcIl5zD6s+9UKIU4VXomUWZrAyptlgaKUsDDm+LIS50kIPR+RotB8DMp 24VDjcABpXyFS4qOi0vCL9d5hs13UU7AD0ctoansj+w9DMw+xkdV6R/pi9qfpBmdAUix W5MOlAhFd2enVq7SWNh61UYuB3l8o/SlczGvG/A+FEDB2PyuP+YjNBYnWNG6Cvdz/bua ycaA== X-Received: by 10.66.220.197 with SMTP id py5mr3112369pac.140.1415889287743; Thu, 13 Nov 2014 06:34:47 -0800 (PST) Date: Thu, 13 Nov 2014 22:34:52 +0800 From: "Yimr Zero" To: python-list Subject: Re: Synchronizing a sound with a widget change References: <54648d03$0$1981$426a74cc@news.free.fr> X-Priority: 3 X-GUID: 36E39166-17EB-4493-A2DE-52995081C487 X-Has-Attach: no X-Mailer: Foxmail 7, 2, 5, 140[cn] Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_001_NextPart406430588155_=----" Cc: ast X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 64 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1415889291 news.xs4all.nl 2915 [2001:888:2000:d::a6]:55695 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:80687 This is a multi-part message in MIME format. ------=_001_NextPart406430588155_=---- Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: base64 SGksDQoNCllvdSBtYXkgdHJ5IHRvIGFkZCB0aGUgc2xlZXAoNSkgYWZ0ZXIgdGhlIGNvbG9yIGNo YW5nZSBzdGF0ZW1lbnQuIFlvdSBjb3VsZCBhZGp1c3QgdGhlIHNsZWVwIHRpbWUgdG8gbGV0IHRo ZSBjb2xvciBjaGFuZ2UgYW5kIGJlZXAgc3luY2hyb2l6ZS4NCg0KVGhhbmtzLg0KDQoNCg0KWWlt ciBaZXJvDQogDQpGcm9tOiBhc3QNCkRhdGU6IDIwMTQtMTEtMTMgMTg6NTANClRvOiBweXRob24t bGlzdA0KU3ViamVjdDogU3luY2hyb25pemluZyBhIHNvdW5kIHdpdGggYSB3aWRnZXQgY2hhbmdl DQpIZWxsbywgaGVyZSBpcyBhIHNtYWxsIHRlc3QgY29kZToNCiANCi0tLS0tLS0tLS0tLS0tLS0N CmZyb20gdGtpbnRlciBpbXBvcnQgVGssIEZyYW1lDQpmcm9tIHdpbnNvdW5kIGltcG9ydCBCZWVw DQogDQpyb290ID0gVGsoKQ0KIA0KZiA9IEZyYW1lKHJvb3QsIHdpZHRoPTMwMCwgaGVpZ2h0PTMw MCkNCmYucGFjaygpDQogDQpmLmNvbmZpZyhiZz0nWWVsbG93JykNCkJlZXAoMjAwMCwgMTAwMCkN Ci0tLS0tLS0tLS0tLS0tDQogDQpJIGludGVuZGVkIHRvIGNoYW5nZSB0aGUgZnJhbWUgY29sb3Ig dG8geWVsbG93IChmLmNvbmZpZyhiZz0nWWVsbG93JykpDQphbmQgYXQgdGhlIHNhbWUgdGltZSB0 byBlbWl0IGEgc291bmQgKEJlZXAoMjAwMCwgMTAwMCkpDQogDQpCdXQgSSBmaXJzdCBoYXZlIHRo ZSBzb3VuZCBhbmQgd2hlbiB0aGUgc291bmQgaXMgb3ZlciB0aGUgd2luZG93IGFwcGVhcnMuDQog DQpJcyB0aGVyZSBhIHdheSB0byBmaXggdGhhdCA/DQogDQpJIGhhdmUgdGhlIGlkZWEgdG8gcnVu IGFuIG90aGVyIHRocmVhZCB0byBlbWl0IHRoZSBzb3VuZCwgYnV0IEkgZGlkbid0IHRyeSB5ZXQu DQpJcyBpdCB0aGUgc29sdXRpb24gPw0KIA0KVGhhbmtzDQogDQogDQogDQo= ------=_001_NextPart406430588155_=---- Content-Type: text/html; charset="ISO-8859-1" Content-Transfer-Encoding: quoted-printable =0A
Hi,

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

Thanks.
=0A


=0A
Yimr Zero
=0A
 
From:<= /b> ast
Date:<= /b> 2014-11-13 18:50
Subject: Sy= nchronizing a sound with a widget change
Hello,= here is a small test code:
=0A
 
=0A
-------------= ---
=0A
from tkinter import Tk, Frame
=0A
from winsound = import Beep
=0A
 
=0A
root =3D Tk()
=0A
&n= bsp;
=0A
f =3D Frame(root, width=3D300, height=3D300)
=0Af.pack()
=0A
 
=0A
f.config(bg=3D'Yellow')
= =0A
Beep(2000, 1000)
=0A
--------------
=0A
 =0A
I intended to change the frame color to yellow (f.config(bg=3D= 'Yellow'))
=0A
and at the same time to emit a sound (Beep(2000, 1= 000))
=0A
 
=0A
But I first have the sound and when= the sound is over the window appears.
=0A
 
=0A
Is= there a way to fix that ?
=0A
 
=0A
I have the ide= a to run an other thread to emit the sound, but I didn't try yet.
=0A=
Is it the solution ?
=0A
 
=0A
Thanks
=0A=
 
=0A
 
=0A
 
=0A
=0A ------=_001_NextPart406430588155_=------