pythonadb,python adb,adb工具,adb脚本,常用adb整合,adb gui,tkinteradb,tkinter adb,调试工具箱,adb调试工具,adb调试脚本

在这里插入图片描述
由python导入tkinter模块编写的gui界面,源码在下面

'''

os.system()方法是简单粗暴的执行cmd指令,没有办法获取到cmd输出的内容。
'''
#导入库
import os
import subprocess
from tkinter import *
from time import strftime
from tkinter.filedialog import *
#初始化窗口root
root = Tk()
#设置窗口root的标题
root.title('adb调试工具')
root.minsize(460,300)
#声明reply为文本变量
reply=StringVar()
reply.set(strftime("%Y年%m月%d日%H时%M分%S秒")+':此处显示执行结果')
Label(root,textvariable=reply,fg='red',font=('楷体',12,'bold')).place(x=0,y=0,width=460,height=60)
def excuteInstall():
    if os.popen("adb install "+askopenfilename()).read():
        reply.set(strftime("%Y年%m月%d日%H时%M分%S秒")+":安装命令已经执行完成!")
    else:
        reply.set(strftime("%Y年%m月%d日%H时%M分%S秒")+":安装命令执行失败!")
def excutePower():
    os.popen("adb shell input keyevent 26")
    reply.set(strftime("%Y年%m月%d日%H时%M分%S秒")+":电源键已经按下!")
def excuteReboot():
    os.popen("adb reboot")
    reply.set(strftime("%Y年%m月%d日%H时%M分%S秒")+":手机重启中!")
def showDevices():
    reply.set(os.popen("adb devices").read()+strftime("%Y年%m月%d日%H时%M分%S秒"))
def debug():
    os.popen("adb shell am set-debug-app -w "+inputValue.get())
    reply.set(strftime("%Y年%m月%d日%H时%M分%S秒")+":开始特殊调试!")
def normalDebug():
    os.popen("adb shell am start -D -n "+inputValue0.get())
    reply.set(strftime("%Y年%m月%d日%H时%M分%S秒")+":开始普通调试!")
h=60
Button(root,text="选择一个apk文件用adb命令安装到手机",command=excuteInstall).place(x=0,y=h,width=230,height=30)
Button(root,text="电源键",command=excutePower).place(x=230,y=h,width=50,height=30)
Button(root,text="手机重启",command=excuteReboot).place(x=280,y=h,width=70,height=30)
Button(root,text="显示连接的设备",command=showDevices).place(x=350,y=h,width=110,height=30)
Button(root,text="右边输入需要调试的包名后点我调试apk的oncreate()",command=debug).place(x=0,y=h+30,width=300,height=30)
inputValue=StringVar()
Entry(root,textvariable=inputValue).place(x=300,y=h+30,width=160,height=30)

Button(root,text="右边输入需要普通调试的'包名/activity'后点我开始调试",command=normalDebug).place(x=0,y=h+30+30,width=300,height=30)
inputValue0=StringVar()
Entry(root,textvariable=inputValue0).place(x=300,y=h+30+30,width=160,height=30)
#每一个gui都要有这个结尾
root.mainloop()

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值