Tkinter使用教程之Android測試工具

2021-09-22 16:29:49 字數 4358 閱讀 6277

實戰解析:

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()

Tkinter教程之Message篇

tkinter教程之message篇 message也是用來顯示文字的,用法與label基本一樣 1.建立乙個簡單的message from tkinter import root tk 執行程式,可以看到hello之後,message顯示在它的下一行,這也是message的乙個特性。label沒有...

Tkinter教程之Canvas篇 3

25.繪製位圖 coding utf 8 使用bitmap建立點陣圖create bitmap from tkinter import root tk 建立乙個canvas,設定其背景色為白色 cv canvas root,bg white d for i in d cv.create bitmap...

git使用教程之了解git

1 理解git快照 快照的作用就相當於將舊檔案所佔的空間保留下來,並且儲存乙個引用,而新檔案中會繼續使用與舊檔案內容相同部分的磁碟空間,不同部分則寫入新的磁碟空間。git有乙個head指標,這個指標可以移動,這個指標移動到哪個快照,你就可以檢視該快照也就是當時的狀態。2 git的三種狀態 已提交 c...