知识点目录:
1、 文本框 Label
var = tk.StringVar() # 文本框 bg 背景颜色 fonnt 字体设置 width 长 height 高 l = tk.Label(root, textvariable=var, bg='green', font=('Arial',12), width=15) l.pack()
![](https://images2018.cnblogs.com/blog/1289780/201807/1289780-20180725170529234-422264247.png)
2、按钮 Button
on_hit = False # 按钮 def hit_me(): global on_hit if on_hit == False: on_hit = True var.set("sasdad") else: on_hit = False var.set("") # command 执行动作 b = tk.Button(root, text='按钮', width=15, height=2, command=hit_me) b.pack()
3、单行输入框 entry
# entry 单行输入框, show显示,掩码的话就show='*', e = tk.Entry(root, show=None) e.pack()