python graphics win.getKey() function?
问题 I am new to python and trying to make a game where an object moves left/right according to the arrow keys on the keyboard. I've seen different methods to do this through importing turtle, curse, etc., but how do I do this using only win.getKey() ? So far I have this, but it isn't working: while True: k = win.checkKey() if k == 'Left': object.move(-dx, dy) elif k == 'Right': object.move(dx, dy) elif k == 'period': break 回答1: Since you only provided a fragment of code, I'm going to make some