tkinter使用按钮

来源:互联网 发布:工程三维设计软件 编辑:程序博客网 时间:2024/06/05 18:43

一 代码

  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()
二 运行结果

 
  • 大小: 3.8 KB
  • 查看图片附件
原创粉丝点击