Unwanted window spawns when using Tkinter with multiprocessing.

Dave Angel d at davea.name
Tue Apr 30 08:30:27 EDT 2013


On 04/30/2013 08:22 AM, alternative00 at rocketmail.com wrote:
>   > Dave A.
>
> Yeah I'm using MRAB's code, my current code is :
>
>
> #Initalisation
> global event
> global hitkey
>
>
> #Functions
> def key(event):
>
>       hitkey = 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)
>
>
> if __name__ == "__main__":
>
>
>       fenetre = Tk()
>       frame = Frame(fenetre, width=200, height=100)
>
>
>       frame.focus_set()
>       frame.bind("<Key>", key)
>       frame.pack()
>       fenetre.mainloop()
>

And you're still getting a new window ?  Wow!


-- 
DaveA



More information about the Python-list mailing list