---恢復內容開始---python
經常使用的python GUI庫——tkinter瀏覽器
import tkinter top = tkinter.Tk(className='python window app') top.mainloop()
1 from tkinter import * 2 import easygui 3 import psutil 4 root = Tk() 5 root.title("瀏覽器之戰") 6 7 #GIRLS = ["Google","IE","Ferox","soudog"] 8 v = IntVar() 9 10 cpu_percent = psutil.cpu_percent(interval=1) 11 cpu_info = "CPU使用率已達到:%i%%" % cpu_percent 12 13 def callback(): 14 easygui.msgbox(cpu_info,title='實際內容是CPU使用率') 15 group = LabelFrame(root,text="最好的瀏覽器是?") #基於root製做一個框架 16 group.pack(padx=70) 17 18 v.set(1) 19 language = [('Google',1), 20 ('IE',2), 21 ('360',3), 22 ('soudog',4)] 23 24 25 for lang,num in language: 26 b = Radiobutton(group,text=lang,variable=v,value=num,indicatoron=False,padx=30,pady=3) 27 l = Label(group,textvariable=v) #將內容添加到框架中 28 29 l.pack() 30 b.pack(anchor=W,fill=X) 31 32 theButton=Button(root,text='就是這個了',command=callback) 33 theButton.pack(pady=20) 34 35 mainloop()
printapp
---恢復內容結束---框架