# ch3_24.py
from tkinter import *
window = Tk()
window.title("ch3_24") # 視窗標題
lab1 = Label(window,text="明志科技大學",
bg="lightyellow", # 標籤背景是淺黃色
width=15) # 標籤寬度是15
lab2 = Label(window,text="長庚大學",
bg="lightgreen", # 標籤背景是淺綠色
width=15) # 標籤寬度是15
lab3 = Label(window,text="長庚科技大學",
bg="lightblue", # 標籤背景是淺藍色
width=15) # 標籤寬度是15
lab1.grid(row=0,column=0) # 格狀包裝
lab2.grid(row=1,column=0) # 格狀包裝
lab3.grid(row=1,column=1) # 格狀包裝
window.mainloop()
# ch3_25.py
from tkinter import *
window = Tk()
window.title("ch3_25") # 視窗標題
lab1 = Label(window,text="明志科技大學",
bg="lightyellow", # 標籤背景是淺黃色
width=15) # 標籤寬度是15
lab2 = Label(window,text="長庚大學",
bg="lightgreen", # 標籤背景是淺綠色
width=15) # 標籤寬度是15
lab3 = Label(window,text="長庚科技大學",
bg="lightblue", # 標籤背景是淺藍色
width=15) # 標籤寬度是15
lab1.grid(row=0,column=0) # 格狀包裝
lab2.grid(row=1,column=2) # 格狀包裝
lab3.grid(row=2,column=1) # 格狀包裝
window.mainloop()
# ch3_26.py
from tkinter import *
window = Tk()
window.title("ch3_26") # 視窗標題
lab1 = Label(window,text="標籤1",relief="raised")
lab2 = Label(window,text="標籤2",relief="raised")
lab3 = Label(window,text="標籤3",relief="raised")
lab4 = Label(window,text="標籤4",relief="raised")
lab5 = Label(window,text="標籤5",relief="raised")
lab6 = Label(window,text="標籤6",relief="raised")
lab7 = Label(window,text="標籤7",relief="raised")
lab8 = Label(window,text="標籤8",relief="raised")
lab1.grid(row=0,column=0)
lab2.grid(row=0,column=1)
lab3.grid(row=0,column=2)
lab4.grid(row=0,column=3)
lab5.grid(row=1,column=0)
lab6.grid(row=1,column=1)
lab7.grid(row=1,column=2)
lab8.grid(row=1,column=3)
window.mainloop()
沒有留言:
張貼留言