Merge pull request '修改源码' (#29) from develop into master
commit
957a623607
@ -1,19 +1,18 @@
|
|||||||
# @Time : 2022/5/9 20:49
|
import pygame
|
||||||
# @Author : 2890199310@qq.com
|
|
||||||
# @File : KeyPress.py
|
|
||||||
# @Software: PyCharm
|
|
||||||
# @Function:
|
|
||||||
|
|
||||||
def main():
|
def init():
|
||||||
keyPress()
|
pygame.init()
|
||||||
|
win = pygame.display.set_mode((400, 400))
|
||||||
def keyPress(key):
|
|
||||||
if(key == 1):
|
|
||||||
return "e"
|
|
||||||
|
|
||||||
def result():
|
|
||||||
return keyPress()
|
|
||||||
|
|
||||||
|
def getKey(keyName):
|
||||||
|
ans = False
|
||||||
|
for eve in pygame.event.get(): pass
|
||||||
|
keyInput = pygame.key.get_pressed()
|
||||||
|
myKey = getattr(pygame,'K_{}'.format(keyName))
|
||||||
|
if keyInput[myKey]:
|
||||||
|
ans = True
|
||||||
|
pygame.display.update()
|
||||||
|
return ans
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
init()
|
@ -1,31 +1,18 @@
|
|||||||
# @Time : 2022/4/20 12:27
|
import pygame
|
||||||
# @Author : 2890199310@qq.com
|
|
||||||
# @File : KeyPressModule.py.py
|
|
||||||
# @Software: PyCharm
|
|
||||||
# @Function:
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/../../PaddleClas-release-2.3")
|
|
||||||
|
|
||||||
# import pygame
|
|
||||||
import Tello.KeyPress as k
|
|
||||||
|
|
||||||
def init():
|
def init():
|
||||||
return
|
pygame.init()
|
||||||
|
win = pygame.display.set_mode((400, 400))
|
||||||
|
|
||||||
def getKey(keyName):
|
def getKey(keyName):
|
||||||
# ans = False
|
ans = False
|
||||||
# for eve in pygame.event.get(): pass
|
for eve in pygame.event.get(): pass
|
||||||
# keyInput = pygame.key.get_pressed()
|
keyInput = pygame.key.get_pressed()
|
||||||
# myKey = getattr(pygame,'K_{}'.format(keyName))
|
myKey = getattr(pygame,'K_{}'.format(keyName))
|
||||||
# if keyInput[myKey]:
|
if keyInput[myKey]:
|
||||||
if keyName == k.result():
|
|
||||||
ans = True
|
ans = True
|
||||||
# pygame.display.update()
|
pygame.display.update()
|
||||||
return ans
|
return ans
|
||||||
|
|
||||||
def key(a):
|
|
||||||
return a
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
init()
|
init()
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue