標題:
圖形介面 (三) - grid排版練習
[打印本頁]
作者:
tonyh
時間:
2023-7-13 16:09
標題:
圖形介面 (三) - grid排版練習
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()
複製代碼
作者:
李沛昂
時間:
2023-7-13 16:13
import tkinter as tk
win=tk.Tk()
win.title("主視窗")
win.resizable(0,0)
lb=tk.Label(win,bg="blue",text="1",font=("微軟正黑體",20),width=10,height=3).grid(row=0,column=0,padx=10,pady=10)
lb=tk.Label(win,bg="green",text="2",font=("微軟正黑體",20),width=10,height=3).grid(row=0,column=1,padx=10,pady=10)
lb=tk.Label(win,bg="yellow",text="3",font=("微軟正黑體",20),width=10,height=3).grid(row=1,column=0,padx=10,pady=10)
lb=tk.Label(win,bg="red",text="4",font=("微軟正黑體",20),width=10,height=3).grid(row=1,column=1,padx=10,pady=10)
win.mainloop()
複製代碼
作者:
王捷恩
時間:
2023-7-13 16:14
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="grey",text="4",font=("微軟正黑體",16), width=10,height=3).grid(row=1,column=1, padx=10,pady=10)
win.mainloop()
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://seed.istak.org.tw/)
Powered by Discuz! 7.2