Compare commits

...

4 Commits

@ -0,0 +1,18 @@
import pygame
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__':
init()

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

File diff suppressed because it is too large Load Diff

@ -92,6 +92,9 @@ class Ui_MainWindow(QtWidgets.QWidget):
#self.status = self.statusTip('虚拟沙盘3D建模系统') # 消息
#self.status.showMessage()
self.setWindowIcon(QIcon("./img/mou.ico")) # 图标
self.drawn_back()
self.__layout_main = QtWidgets.QVBoxLayout()
self.__layout_fun_button = QtWidgets.QHBoxLayout()
@ -133,8 +136,71 @@ class Ui_MainWindow(QtWidgets.QWidget):
self.button_close.clicked.connect(self.onClick_Button)
self.button_make.clicked.connect(self.showDialog)
self.button_takephoto.clicked.connect(self.take_photo)
self.button_operate.clicked.connect(self.keyboard_control)
def drawn_back(self):
self.palette = QPalette()
self.palette.setBrush(QPalette.Background, QBrush(QPixmap("./img/back.jpeg")))
self.setPalette(self.palette)
def keyboard_control(self):
dialog = QtWidgets.QDialog()
dialog.resize(400, 300)
# button = QtWidgets.QPushButton('储存', dialog)
# button.clicked.connect(dialog.close)
# button.move(350, 550)
dialog.setWindowTitle('键盘控制')
dialog.setWindowModality(QtCore.Qt.ApplicationModal)
# dialog.__layout_main = QtWidgets.QHBoxLayout()
# dialog.__layout_fun_button = QtWidgets.QVBoxLayout()
# dialog.__layout_data_show = QtWidgets.QVBoxLayout()
# dialog.button_takeoff = QtWidgets.QPushButton('起飞')
# dialog.button_set_down = QtWidgets.QPushButton('降落')
# dialog.button.takeoff.setMinimumHeight(50)
# dialog.button_takeoff.move(250, 200)
# dialog.button_takeoff.setMinimumHeight(50)
# dialog.button_set_down.setMinimumHeight(50)
#
# dialog.button_takeoff.move(10, 100)
button_takeoff = QtWidgets.QPushButton('起飞', dialog)
button_takeoff.move(200, 100)
button_set_down = QtWidgets.QPushButton('降落', dialog)
button_set_down.move(200, 150)
lab1 = QLabel()
# lab1.resize(200, 200) # 重设Label大小
# lab1.setScaledContents(True) # 设置图片自适应窗口大小
lab1.setPixmap(QPixmap("./img/control.png"))
vbox = QVBoxLayout()
vbox.addWidget(lab1)
dialog.setLayout(vbox)
#dialog.label_show_camera = QtWidgets.QLabel()
# self.label_show_camera.move(400,400)
#dialog.label_show_camera.setFixedSize(841, 681)
# dialog.__layout_fun_button.addWidget(dialog.button_takeoff)
# dialog.__layout_fun_button.addWidget(dialog.button_set_down)
#
# # self.__layout_fun_button.addWidget(self.label)
# dialog.__layout_main.addLayout(dialog.__layout_fun_button)
# dialog.__layout_main.addWidget(lab1)
#
# dialog.setLayout(dialog.__layout_main)
#self.show()
dialog.show()
#sys.exit(app.exec_())
dialog.exec()
def take_photo(self):
#video to photo
args = video_to_photo.parse_args()

Loading…
Cancel
Save