我正在制作一个程序来检查python中的adb设备
我无法弹出窗口,请更正我的代码。
从PyQt4导入sys导入子进程导入QtGui,QtCore
ad = subprocess.check_output([“ adb”,“ devices”])
class Example(QtGui.QWidget):
def __init__(self):
super(Example, self).__init__()
self.initUI()
def initUI(self):
QtGui.QToolTip.setFont(QtGui.QFont('SansSerif', 10))
btn = QtGui.QPushButton('Check Device', checkadb(ad))
btn.resize(135, 30)
btn.move(50, 10)
self.setGeometry(250, 250, 400, 400)
self.setWindowTitle('Tooltips')
self.show()
def clicked(*args):
QtGui.QMessageBox.about(QtGui, "No Device Found")
def clicked2(*args):
QtGui.QMessageBox.about(QtGui, "Device Found")
def checkadb(ad):
if len(ad) <= 27:
clicked()
elif len(ad) > 27:
clicked2()
def main():
app = QtGui.QApplication(sys.argv)
ex = Example()
sys.exit(app.exec_())
if __name__ == '__main__':
main()
婷婷同学_
相关分类