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