单击按钮发送adb命令python

时间:2016-09-14 02:27:29

标签: android python

我想构建一个程序,在我点击时将adb命令发送到手机 按钮,我尝试使用以下代码,但命令不会发送到设备。

from Tkinter import *
import os
import subprocess

root = Tk()
root.title("MUT Tester")
root.geometry("500x500")

def button():

cmd= os.system("adb devices")


b = Button(root, text="Enter", width=30, height=2, command = lambda:(button))
b.pack()

root.mainloop()

1 个答案:

答案 0 :(得分:0)

在这一行:

b = Button(root, text="Enter", width=30, height=2, command = lambda:(button))

当您单击(用print语句替换按钮以进行测试)时,按钮功能不会被命令调用。删除lambda并使用command = button替换它。

相关问题