1.按钮
# 按钮 # bg设置背景色 btn = tkinter.Button(root,text = '按钮',bg = 'red') btn.pack() # fg设置前景色(文字颜色) btn1 = tkinter.Button(root,text = '按钮',fg = 'blue') btn1.pack() # font设置字体大小和样式(字体,大小,粗体,斜体等) btn2 = tkinter.Button(root,text = '按钮',font = ('楷体',20,'italic')) btn2.pack() # 设置按钮高度和宽度单位:字符大小(不推荐用) btn3 = tkinter.Button(root,text = '按钮',height = 4,width = 10) btn3.pack() # 设置多行文本的对齐方式right/left btn4 = tkinter.Button(root,text = '孙悟空大\n闹天宫',justify = 'right') btn4.pack() # state 状态 active(激活), disabled(不能点), or normal(正常) btn5 = tkinter.Button(root,text = '按钮',state = 'disabled') btn5.pack() # 边框粗细 btn5 = tkinter.Button(root,text = '按钮',bd = 5) btn5.pack()