- import tkinter as tk
- win=tk.Tk()
- win.title("主視窗")
- win.resizable(0,0)
- fm=tk.Frame(win)
- lb=tk.Label(fm,bg="blue",text="1",font=("微軟正黑體",16),
- width=10,height=3).grid(row=0,column=0,padx=10,pady=10)
- lb=tk.Label(fm,bg="green",text="2",font=("微軟正黑體",16),
- width=10,height=3).grid(row=0,column=1,padx=10,pady=10)
- fm.pack()
- fm=tk.Frame(win)
- lb=tk.Label(fm,bg="red",text="3",font=("微軟正黑體",16),
- width=10,height=3).grid(row=0,column=0,padx=10,pady=10)
- lb=tk.Label(fm,bg="gray",text="4",font=("微軟正黑體",16),
- width=10,height=3).grid(row=0,column=1,padx=10,pady=10)
- fm.pack()
- win.mainloop()
複製代碼 |