|

楼主 |
发表于 2020-9-25 14:44:55
|
显示全部楼层
合并的代码:
- import os
- import sys
- import time
- from PyQt5.Qt import QWidget, QApplication
- from PyQt5.QtGui import QPixmap
- from PyQt5.QtWidgets import QPushButton, QVBoxLayout, QLabel
- class TP(QWidget):
- # 开始
- def TKS(self, rr):
- self.rr = rr
- # 发送adb连接命令
- a = 'adb connect ' + self.rr
- # 启动安卓界面
- s = 'scrcpy.exe'
- os.popen(a, 'r')
- time.sleep(1)
- os.popen(s, 'r')
- # 关闭
- def TGB(self):
- c = 'adb disconnect 192.168.0.132:5555'
- os.popen(c, 'r')
- # 当程序关闭时,再次调用 关闭 函数
- def closeEvent(self, event):
- self.TGB()
- class QpixmapDemo(QWidget):
- def __init__(self, parent=None):
- super(QpixmapDemo, self).__init__(parent)
- self.setWindowTitle('快捷键')
- layout = QVBoxLayout()
- lab1 = QLabel()
- lab1.setPixmap(QPixmap('1.png'))
- layout.addWidget(lab1)
- self.setLayout(layout)
- if __name__ == '__main__':
- a = 'adb connect 192.168.0.132:5555'
- os.popen(a, 'r')
- app = QApplication(sys.argv)
- win = TP()
- win.setWindowTitle("安卓桌面")
- win.resize(300, 200)
- btn = QPushButton(win)
- btn.setText("开始")
- btn.setStyleSheet("font:40px")
- btn.resize(100, 50)
- btn.move(50, 50)
- btn.clicked.connect(lambda: win.TKS('192.168.0.132:5555'))
- btn2 = QPushButton(win)
- btn2.setText("关闭")
- btn2.setStyleSheet("font:40px")
- btn2.resize(100, 50)
- btn2.move(150, 50)
- btn2.clicked.connect(win.TGB)
- ti = QpixmapDemo()
- btn3 = QPushButton(win)
- btn3.setText("帮助")
- btn3.setStyleSheet("font:40px")
- btn3.resize(100, 50)
- btn3.move(50, 100)
- btn3.clicked.connect(ti.show)
- win.show()
- sys.exit(app.exec_())
复制代码
我就只加了 -F -w 没有其他的了,我现在试试 什么参数都不加看看。 |
|