Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4.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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'english.': 0.04; 'argument': 0.05; 'tkinter': 0.07; '"__main__":': 0.09; '__name__': 0.09; 'clause': 0.09; 'key.': 0.09; 'subject:using': 0.09; 'window.': 0.09; 'def': 0.12; 'gui': 0.12; 'windows': 0.15; 'bypassing': 0.16; 'pressed': 0.16; 'process?': 0.16; 'script?': 0.16; 'subject:Tkinter': 0.16; 'subject:skip:m 10': 0.16; 'subject:when': 0.16; 'wrote:': 0.18; 'code,': 0.22; 'otherwise,': 0.22; 'header:User-Agent:1': 0.23; 'gets': 0.27; 'header:In-Reply- To:1': 0.27; 'function': 0.29; 'code': 0.31; 'file': 0.32; 'skip:m 30': 0.32; 'running': 0.33; 'subject:with': 0.35; 'module.': 0.36; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'bad': 0.39; 'to:addr:python.org': 0.39; 'even': 0.60; 'new': 0.61; 'received:74.208': 0.68; 'email addr:rocketmail.com': 0.84; 'received:74.208.4.194': 0.84; 'skip:w 60': 0.84; 'subject:Unwanted': 0.84; 'on?': 0.91 Date: Sun, 28 Apr 2013 19:10:17 -0400 From: Dave Angel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Unwanted window spawns when using Tkinter with multiprocessing. References: <7df67006-2176-42cb-a8ce-95a72339e7e2@googlegroups.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:b+pI40z9QkITJQ3eov7MaAgT/OrzujJSXXer+NmaPSF M9u1hiAM5HJJDRkkuxeOAgBLsCULKmka3y48GuY9c/Q0ZRmCSB RcNLNTdeJJ7Je6y5Jy9PD0+wddhpmSAIKVUAXgKlMA6u2BGRXI Tupiz5kIVv2AA8EYgAzQsuidCl4RgeZ2rshwP2Oc0AwKr2OSXD g+4x7QyKfA43V84j49cw58GMir1I4kAarXNdQV8alUfT5NlUjY AWjG4jM+3QpIhHLcCXQ01U2CJJDgqcH9z8MYe/GTg/oqyQ3uM8 vq06/vc9o76mgbrjks2l+FwFMcAwd3620UNSn1WhY7PjlP9dQ= = 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: 38 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1367190638 news.xs4all.nl 15924 [2001:888:2000:d::a6]:45421 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:44479 On 04/28/2013 06:23 PM, alternative00@rocketmail.com wrote: > Sorry for my bad english. > > Here's my code : > > def key(event): > > instance = 'Instance' > touche = event.char > instance = multiprocessing.Process(target=player, args=(hitkey,)) > instance.start() > > > > def player(hitkey): > > > winsound.PlaySound(hitkey + '.wav', winsound.SND_FILENAME|winsound.SND_NOWAIT|winsound.SND_ASYNC) > > 'key' is the tkinter function wich gets the pressed key. > 'player' is the function playing a specific wav file depending on wich key is pressed, that's why its argument is 'hitkey'. It uses the winsound module. > > What spawns new windows is theorically the multiprocessing line of code, even if it's inside the 'key' function. > Do you have an if __name__ == "__main__": clause in your main script? Are you bypassing the gui event loop on the secondary process? Otherwise, it's your code that's launching the extra window. And what OS are you running on? -- DaveA