# -*- coding: utf-8 -*- import tkinter as tk root = tk.Tk() root.title("tk15.py") root.geometry("250x170") ##################################### frame_Top = tk.Frame(root, bd = 5, bg = 'lightblue', highlightthickness = 5, highlightbackground = 'red') lb1 = tk.Label(frame_Top, text = 'Label 1', fg = "#ab0f12") bt1 = tk.Button(frame_Top, text = 'Button 1', fg = "#fb0fff") frame_Bottom = tk.Frame(root, bd = 5, bg = 'lightgreen', highlightthickness = 5, highlightbackground = 'red') lb2 = tk.Label(frame_Bottom, text = 'Label 2', fg = "#a00012") bt2 = tk.Button(frame_Bottom, text = 'Button 2', fg = "#000f1f") frame_Left = tk.Frame(root, bd = 5, bg = 'lightgreen', highlightthickness = 5, highlightbackground = 'blue') lb3 = tk.Label(frame_Left, text = 'Label 3', fg = "#ab0f12") bt3 = tk.Button(frame_Left, text = 'Button 3', fg = "#fb0fff") frame_Right = tk.Frame(root, bd = 5, bg = 'lightgreen', highlightthickness = 5, highlightbackground = 'blue') lb4 = tk.Label(frame_Right, text = 'Label 4', fg = "#ab0f12") bt4 = tk.Button(frame_Right, text = 'Button 4', fg = "#fb0fff") frame_Center = tk.Frame(root, bd = 5, bg = 'lightgreen', highlightthickness = 5, highlightbackground = 'gold') lb5 = tk.Label(frame_Center, text = 'Label 5', fg = "#ab0f12") bt5 = tk.Button(frame_Center, text = 'Button 5', fg = "#fb0fff") frame_Top.pack(side = tk.TOP) frame_Bottom.pack(side = tk.BOTTOM) lb1.pack(side = tk.LEFT) bt1.pack(side = tk.LEFT) lb2.pack(side = tk.LEFT) bt2.pack(side = tk.LEFT) frame_Left.pack(side = tk.LEFT) frame_Right.pack(side = tk.RIGHT) frame_Center.pack() lb3.pack(side = tk.TOP) bt3.pack(side = tk.TOP) lb4.pack(side = tk.TOP) bt4.pack(side = tk.TOP) lb5.pack() bt5.pack() ##################################### root.mainloop()