tkinter使用按钮

一 代码

  1. import tkinter
  2. root = tkinter.Tk()
  3. button1 = tkinter.Button(root,
  4. anchor =tkinter.E,
  5. text="Button1",
  6. width =40,
  7. height =5)
  8. button1.pack()
  9. button2 = tkinter.Button(root,
  10. text="Button2",
  11. bg ='blue')
  12. button2.pack()
  13. button3 = tkinter.Button(root,
  14. text="Button3",
  15. width =14,
  16. height =1)
  17. button3.pack()
  18. button4 = tkinter.Button(root,
  19. text="Button4",
  20. width =60,
  21. height =5,
  22. state = tkinter.DISABLED)
  23. button4.pack()
  24. root.mainloop()
二 运行结果

 

猜你喜欢

转载自cakin24.iteye.com/blog/2384228