3 TKinter设置宽高及背景色
代码示例
#!/usr/bin/env python # _*_ coding:utf-8 _*_ from Tkinter import * root = Tk() B1 = Button(root,text='按扭一') B2 = Button(root,text='按扭二') B1['height']=5 B1['width']=20 B2['height']=5 B2['width']=18 B2['background']='green' B1.pack() B2.pack() root.mainloop()
效果图