# -*- coding: utf-8 -*- import tkinter as tk root = tk.Tk() root.title("tk2.py") root.geometry('200x200') ##################################### lb_left = tk.Label(root, text = "左邊",\ width = 8, bg='#00ff00') lb_right = tk.Label(root, text = "右邊",\ fg = 'white', width = 8, bg='#0000ff') lb_top = tk.Label(root, text = "上面",\ width = 8, bg='#ff0000') lb_bottom = tk.Label(root, text = "下面",\ width = 8, bg='#0ffff0') lb_center = tk.Label(root, text="中間",\ width = 8, bg = 'pink') lb_left.pack(side = tk.LEFT) lb_right.pack(side = tk.RIGHT) lb_top.pack() lb_bottom.pack(side = tk.BOTTOM) lb_center.pack(fill = tk.Y, expand = True) ##################################### root.mainloop()