Skip to content

Instantly share code, notes, and snippets.

@sprae
Created April 28, 2013 19:05
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save sprae/5478016 to your computer and use it in GitHub Desktop.
Program generujący dźwięk dla przyciśniętych klawiszy. Python, Windows
import pygame
import pythoncom
import pyHook
def main():
pygame.mixer.pre_init(44100, -16, 2, 2048)
pygame.mixer.init()
sound = pygame.mixer.Sound('akeys.ogg')
def onKeyDown(event):
sound.play()
hook = pyHook.HookManager()
hook.KeyDown = onKeyDown
hook.HookKeyboard()
pythoncom.PumpMessages()
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment