tkinter使用标签

阅读更多

一 代码

  1. import tkinter
  2. root = tkinter.Tk()
  3. label1 = tkinter.Label(root,
  4. anchor =tkinter.E,
  5. text="Button1",
  6. bg ='blue',
  7. fg ='red',
  8. width =30,
  9. height =5)
  10. label1.pack()
  11. label2 = tkinter.Label(root,
  12. text="Python GUI\ntkinter",
  13. justify = tkinter.LEFT,
  14. width =30,
  15. height =5)
  16. label2.pack()
  17. label3 = tkinter.Label(root,
  18. text="Python GUI\ntkinter",
  19. justify = tkinter.RIGHT,
  20. width =30,
  21. height =5)
  22. label3.pack()
  23. label4 = tkinter.Label(root,
  24. text="Python GUI\ntkinter",
  25. justify = tkinter.CENTER,
  26. width =30,
  27. height =5,
  28. )
  29. label4.pack()
  30. root.mainloop()
二 运行结果
tkinter使用标签_第1张图片
 
  • tkinter使用标签_第2张图片
  • 大小: 4.3 KB
  • 查看图片附件

你可能感兴趣的:(tkinter,标签)