Merge pull request '修改源码' (#29) from develop into master
commit
957a623607
@ -1,19 +1,18 @@
|
||||
# @Time : 2022/5/9 20:49
|
||||
# @Author : 2890199310@qq.com
|
||||
# @File : KeyPress.py
|
||||
# @Software: PyCharm
|
||||
# @Function:
|
||||
import pygame
|
||||
|
||||
def main():
|
||||
keyPress()
|
||||
|
||||
def keyPress(key):
|
||||
if(key == 1):
|
||||
return "e"
|
||||
|
||||
def result():
|
||||
return keyPress()
|
||||
def init():
|
||||
pygame.init()
|
||||
win = pygame.display.set_mode((400, 400))
|
||||
|
||||
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__':
|
||||
main()
|
||||
init()
|
@ -1,31 +1,18 @@
|
||||
# @Time : 2022/4/20 12:27
|
||||
# @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
|
||||
import pygame
|
||||
|
||||
def init():
|
||||
return
|
||||
pygame.init()
|
||||
win = pygame.display.set_mode((400, 400))
|
||||
|
||||
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]:
|
||||
if keyName == k.result():
|
||||
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()
|
||||
pygame.display.update()
|
||||
return ans
|
||||
|
||||
def key(a):
|
||||
return a
|
||||
|
||||
if __name__ == '__main__':
|
||||
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