一、创建单选框
form tkinter import *
window = tk()
w1 = IntVar()
w1.set(1)
def Occupation():
lable = Label(text="请选择职业").place(x=20,y=15)
m=1
for i in occupation_list:
a = Radiobutton(window, variable=w1, text=i, value=m,).place(x=20, y=20+m*20)
m = m+1
**通过单选框的位置得到value的值(第几号),并通过第几号得到相应的内容及text的值
zhi1 = w1.get()
zhi2 = occupation_list [ zhi1 - 1]
二、创建数据表格视图(Treeview)
form tkinter import ttk
window = Tk()
def SjTreeview():
tree = ttk.Treeview(window,show="headings",columns=("职业","种族"),height=15)
tree.column("职业",width=50,anchor=‘center‘)
tree.column("种族",width=50,anchor=‘center‘)
tree.heading("职业",text="职业")
tree.heading("种族",text="种族")
tree.place(x=200,y=20)
三、创建按钮
def Tbutton():
button = Button(window,text="添加",command=tianjia).place(x=300,y=300)
button = Button(window,text="删除",command=del_func).place(x=350, y=300)
button = Button(window,text="清空",command=clear_treeview).place(x=400, y=300)
四、窗口的自循环启动
window.title("DOTA2自走棋Buff")
window.geometry("420x570")
window.mainloop()