Path: csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'yet.': 0.04; 'root': 0.05; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'windows,': 0.09; 'python': 0.11; 'gui': 0.12; 'wrote': 0.14; 'thread': 0.14; 'blocking': 0.16; 'called,': 0.16; 'emit': 0.16; 'nope,': 0.16; 'received:80.91.229.3': 0.16; 'received:97': 0.16; 'received:plane.gmane.org': 0.16; 'sound,': 0.16; 'finished': 0.19; 'seems': 0.21; '>>>': 0.22; 'read,': 0.26; 'header:X -Complaints-To:1': 0.27; 'idea': 0.28; 'function': 0.29; "doesn't": 0.30; 'run': 0.32; 'subject:with': 0.35; 'but': 0.35; "didn't": 0.36; 'possible': 0.36; 'stable': 0.38; 'window': 0.38; 'to:addr:python-list': 0.38; 'environment.': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'color': 0.61; 'back': 0.62; 'times': 0.62; 'sound': 0.68; 'therefore': 0.72; 'skip:n 40': 0.81; 'subject:skip:S 10': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dave Angel Subject: Re: Synchronizing a sound with a widget change Date: Thu, 13 Nov 2014 06:42:55 -0500 (EST) Organization: news.gmane.org References: <54648d03$0$1981$426a74cc@news.free.fr> <54648e75$0$12771$426a74cc@news.free.fr> <546490c1$0$2890$426a74cc@news.free.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: 97.73.240.77 X-Newsreader: PiaoHong.Usenet.Client.VIP:1.65 X-Archive: encrypt 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: 55 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1415878987 news.xs4all.nl 2861 [2001:888:2000:d::a6]:33219 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:80681 "ast" Wrote in message: > > "ast" a écrit dans le message de news:54648e75$0$12771$426a74cc@news.free.fr... >> >> "ast" a écrit dans le message de >> news:54648d03$0$1981$426a74cc@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