宽度

  1. # 最大宽度
  2. root.maxsize(300,300)
  3. # 最小宽度
  4. root.minsize(200,200)

Label图片

  1. from tkinter import *
  2. from PIL import ImageTk, Image
  3. img = ImageTk.PhotoImage(Image.open('image-16.jpg'))
  4. panel = Label(root, image = img)
  5. panel.pack(side = "bottom", fill = "both", expand = "yes")

字体

  1. import tkinter as tk
  2. from tkinter import *
  3. import tkinter.font as TkFont
  4. font1 = TkFont.Font(family="Times",size=10,weight="bold")
  5. font2 = TkFont.Font(family="Helvetica",size=12,weight="bold")
  6. font3 = TkFont.Font(family="verdana",size=15,weight="bold")
  7. font4 = TkFont.Font(family="opensans",size=20,weight="bold")
  8. font5 = TkFont.Font(family="Symbol",size=25,weight="bold")
  9. l1 = Label(root,text="This is first Font", font = font1,bg="red")
  10. l1.pack()
  11. l2 = Label(root,text="This is Second Font", font= font2,fg="red")
  12. l2.pack()
  13. l3 = Label(root,text="This is Third Font", font= font3)
  14. l3.pack()
  15. l4 = Label(root,text="This is Fourth Font", font= font4, fg="cyan")
  16. l4.pack()
  17. l5 = Label(root,text="This is Fifth Font", font= font5, fg="white",bg="black")
  18. l5.pack()
  19. l6 = Label(root,text="This is Last Font", font=("verdana",10,"bold"))
  20. l6.pack()