Tkinter使用教程之Android测试工具

本文详细介绍了如何在Tkinter环境下进行Android测试工具的使用,通过实战解析,帮助读者掌握利用Tkinter进行Android应用测试的方法和技巧。

实战解析:

from tkinter import *
from tkinter import ttk

def create_window():
    # 创建窗口
    root = Tk()
    root.title('AndroidTool')
    root.geometry('360x282')
    root.resizable(0,0)
    # 标题行功能
    label00 = Label(root, text='截图', font=('微软雅黑',10,'bold'))
    label00.grid(row=0,column = 0)
    label01 = Label(root, text='抓log', font=('微软雅黑',10,'bold'), width=10,height=1)
    label01.grid(row=0, column=1)
    label02 = Label(root, text='停止log', font=('微软雅黑',10,'bold'), width=10, height=1)
    label02.grid(row=0, column=2)
    label03 = Label(root, text='关于', font=('微软雅黑',10,'bold'), width=10, height=1)
    label03.grid(row=0, column=3)
    sh = ttk.Separator(root, orient=HORIZONTAL)
    sh.grid(row=1, column=0, columnspan=4, sticky="we")

    # 标签内容
    label20 = Label(root, text='PckName:', font=('微软雅黑', 8,'bold'), width=14, height=1)
    label20.grid(row=2, column=0,columnspan=2)
    label30 = Label(root, text='PckBit:', font=('微软雅黑', 8,'bold'), width=14, height=1)
    label30.grid(row=3, column=0,columnspan=2)
    label40 = Label(root, text='Launch_Acitivity:', font=('微软雅黑', 8,'bold'), width=14, height=1)
    label40.grid(row=4, column=0,columnspan=2)
    label50 = Label(root, text='TopActivity:', font=('微软雅黑', 8,'bold'), width=14, height=1)
    label50.grid(row=5, column=0,columnspan=2)
    label60 = Label(root, text='PckPath:', font=('微软雅黑', 8,'bold'), width=14, height=1)
    label60.grid(row=6, column=0,columnspan=2)
    label70 = Label(root, text='versionName:', font=('微软雅黑', 8,'bold'), width=14, height=1)
    label70.grid(row=7, column=0,columnspan=2)
    label80 = Label(root, text='verisonCode:', font=('微软雅黑', 8,'bold'), width=14, height=1)
    label80.grid(row=8, column=0,columnspan=2)
    label90 = Label(root, text='minSdk:', font=('微软雅黑', 8,'bold'), width=14, height=1)
    label90.grid(row=9, column=0,columnspan=2)
    label100 = Label(root, text='targetSdk:', font=('微软雅黑', 8,'bold'), width=14, height=1)
    label100.grid(row=10, column=0,columnspan=2)
    # 输入框
    entry22 = Entry(root,width=24)
    entry22.insert(END, 'com.tencent.mm')
    entry22.grid(row=2,column=2,columnspan=2,sticky=W)
    label32 = Label(root, text = "PckBit", font=('微软雅黑', 8,'bold'), width=14, height=1)
    label32["text"] = " PckBit"
    label32.grid(row=3,column=2,columnspan=2,sticky=W)
    entry42 = Entry(root, width=24)
    entry42.insert(END, 'com.tencent.mm')
    entry42.grid(row=4, column=2, columnspan=2, sticky=W)
    entry52 = Entry(root, width=24)
    entry52.insert(END, 'com.tencent.mm')
    entry52.grid(row=5, column=2, columnspan=2, sticky=W)
    entry62 = Entry(root, width=24)
    entry62.insert(END, 'com.tencent.mm')
    entry62.grid(row=6, column=2, columnspan=2, sticky=W)
    label72 = Label(root, text="versionName", font=('微软雅黑', 8, 'bold'), width=14, height=1)
    label72["text"] = " versionName"
    label72.grid(row=7, column=2, columnspan=2, sticky=W)
    label82 = Label(root, text="verisonCode", font=('微软雅黑', 8, 'bold'), width=14, height=1)
    label82["text"] = " verisonCode"
    label82.grid(row=8, column=2, columnspan=2, sticky=W)
    label92 = Label(root, text="minSdk", font=('微软雅黑', 8, 'bold'), width=14, height=1)
    label92["text"] = "minSdk"
    label92.grid(row=9, column=2, columnspan=2, sticky=W)
    label102 = Label(root, text="targetSdk", font=('微软雅黑', 8, 'bold'), width=14, height=1)
    label102["text"] = "targetSdk"
    label102.grid(row=10, column=2, columnspan=2, sticky=W)

    # 按钮功能
    button110 = Button(root, text='获取APK信息',width=25, font=('微软雅黑', 8,'bold'),bg ='#c0c0c0')
    button110.grid(row=11,column=0,columnspan=2)
    button112 = Button(root, text='获取设备信息', width=25, font=('微软雅黑', 8,'bold'),bg ='#c0c0c0')
    button112.grid(row=11, column=2, columnspan=2)
    button120 = Button(root, text='强行停止应用', width=25, font=('微软雅黑', 8,'bold'),bg ='#c0c0c0')
    button120.grid(row=12, column=0, columnspan=2)
    button122 = Button(root, text='清除数据并启动', width=25, font=('微软雅黑', 8,'bold'),bg ='#c0c0c0')
    button122.grid(row=12, column=2, columnspan=2)

    root.mainloop()

create_window()

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值