File tree Expand file tree Collapse file tree 1 file changed +17
-18
lines changed
Expand file tree Collapse file tree 1 file changed +17
-18
lines changed Original file line number Diff line number Diff line change 11# Módulos | imports
22import sys
3- import keyboard
43import pygame
54from pygame .locals import *
65from sympy import Point , pi , sin , cos
@@ -128,15 +127,20 @@ def main():
128127 # ----------
129128 for evento in pygame .event .get ():
130129
131- # window quit event
132- if evento .type == QUIT :
133- sys .exit (0 )
134- pass
135-
136130 # keyboard input
131+ # ----------
137132 if evento .type == pygame .KEYDOWN or evento .type == pygame .KEYUP :
138- print (f'Key event captures for key = "{ evento .key } "' )
139-
133+ print (f'Key event captures for key = "{ pygame .key .name (evento .key )} "' )
134+
135+ # handle special keyboard inputs
136+ # ----------
137+ # quit exit on "Esc" pressed
138+ if evento .key == pygame .K_ESCAPE :
139+ print ("\n you pressed ESCAPE, so exiting...\n " )
140+ sys .exit (0 )
141+ pass
142+ # ----------
143+ # handle modifier key presses
140144 if evento .mod == pygame .KMOD_NONE :
141145 print ('No modifier keys were in a pressed state when this '
142146 'event occurred.' )
@@ -153,20 +157,15 @@ def main():
153157 pass
154158 pass
155159 pass
156- pass
157- pass
158160
159- # handle special keyboard inputs
160- # ----------
161- try :
162- # quit exit on "Esc" pressed
163- if keyboard .is_pressed ('Esc' ):
164- print ("\n you pressed Esc, so exiting...\n " )
161+ # window quit event
162+ # ----------
163+ if evento .type == QUIT :
165164 sys .exit (0 )
166165 pass
166+
167167 pass
168- except :
169- break
168+ pass
170169
171170 return 0
172171 pass
You can’t perform that action at this time.
0 commit comments