key capture

Rhodri James rhodri at wildebst.demon.co.uk
Mon Feb 2 20:47:28 EST 2009


On Mon, 02 Feb 2009 10:45:21 -0000, Tino Wildenhain <tino at wildenhain.de>
wrote:

> Hi,
>
> swamynathan wrote:
>> hello,
>> im making a virtual piano in python where on key stroke a wav is played
>> from a location
>> now to implement  a fully functional piano i need to have multiple key
>> stroke captures  ie if 2 or 3 keys pressed then the function which
>> playes the wav is called with 3 parameters
>
>
>> how to implement this or any other suggestion(i was asked to try multi
>> threading which dint seem optimal)
>
> Are you trying to do this with a computer keyboard or with an
> attached midi or usb music keybord? If the former, you are probably
> w/o luck because afaik there is no way to track the event
> of having random keys pressed the same time.

Yes there is.  You need to use one of the GUIs (Tkinter, wxPython,
PyGame, etc), all of which will give you Key Down/Key Up events.

-- 
Rhodri James *-* Wildebeeste Herder to the Masses



More information about the Python-list mailing list