python keypress simple game
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I would like to see on screen a sign, e.x might be (hash) '#'. Sign will have some starting position, let's say (0, 0). I would like to see sign moving right if I press right arrow, left if I press left arrow, etc. So far my code looks like this, and it works for reading pos, but I want to add some kind of "animation" so I can see sign is moving on the screen: !Update: Just to give u a clue, I created "icon" and now when u press right or left, icon moves in desired direction. from msvcrt import getch icon = chr(254) pos = [0, 0] t = [] def