标签:var 数据窗 class center style TreeView oop import 单选框
form tkinter import * #创建窗口体 window = tk() #初始化组合件绑定 w1 = IntVar() #设置初始选择项1 w1.set(1) def Occupation(): lable = Label(text="请选择职业").place(x=20,y=15) m=1 for i in occupation_list: #创建单选框,绑定到window窗口,组合件绑定,设置单选内容,设置初始化选项值 a = Radiobutton(window, variable=w1, text=i, value=m,).place(x=20, y=20+m*20) m = m+1
form tkinter import ttk window = Tk() def SjTreeview(): #创建数据窗体绑定到window中,show="headings" 首列隐藏,并设立2个标签,高度15 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()
标签:var 数据窗 class center style TreeView oop import 单选框
原文地址:https://www.cnblogs.com/cxys85/p/10438234.html