Zulko / pianoputer

Use your computer keyboard as a "piano".
http://zulko.github.io/blog/2014/03/29/soundstretching-and-pitch-shifting-in-python/
Other
324 stars 92 forks source link

hey why doesnt this thing get fixed #33

Open nazlicodings opened 1 month ago

nazlicodings commented 1 month ago

import pygame pygame.init() a=500 b=500 screen=pygame.display.set_mode((a,b)) run=True x=250 y=250 while run: for event in pygame.event.get(): if event.type==pygame.KEYDOWN: if event.key==pygame.k_w: y=y-5 if y<=0: y=b if event.key==pygame.k_s: y=y+5 if y>=b: y=0 if event.key==pygame.k_a: x=x-5 if x<=0: x=a if event.key==pygame.k_d:
x=x+5 if x>=a: x=0

screen.fill((0,0,0))
pygame.draw.circle(screen,(255,255,255),(x,y),20,0)
pygame.display.update()
pygame.displaySurfacequit()

and this happens when i run the file Python 3.12.3 (tags/v3.12.3:f6650f9, Apr 9 2024, 14:05:25) [MSC v.1938 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license()" for more information.

= RESTART: C:\Users\zagros\Desktop\کد خودم.py pygame 2.5.2 (SDL 2.28.3, Python 3.12.3) Hello from the pygame community. https://www.pygame.org/contribute.html Traceback (most recent call last): File "C:\Users\zagros\Desktop\کد خودم.py", line 16, in if event.key==pygame.k_s: AttributeError: 'pygame.event.Event' object has no attribute 'key'

richardgrechko commented 4 days ago

offtopic