2022年11月17日 星期四

Python GUI 配置管理員pack() EX3.31 , 3.32 , 3.33 , 3.34

 # ch3_31.py

from tkinter import *


window = Tk()

window.title("ch3_31")              # 視窗標題

lab1 = Label(window,text="明志工專")

lab2 = Label(window,bg="yellow",width=20)

lab3 = Label(window,text="明志科技大學")

lab4 = Label(window,bg="aqua",width=20)

lab1.grid(row=0,column=0,padx=5,pady=5)

lab2.grid(row=0,column=1,padx=5,pady=5)

lab3.grid(row=1,column=0,padx=5)

lab4.grid(row=1,column=1,padx=5)


window.mainloop()


# ch3_32.py

from tkinter import *


window = Tk()

window.title("ch3_32")              # 視窗標題

lab1 = Label(window,text="明志工專")

lab2 = Label(window,bg="yellow",width=20)

lab3 = Label(window,text="明志科技大學")

lab4 = Label(window,bg="aqua",width=20)

lab1.grid(row=0,column=0,padx=5,pady=5,sticky=W)

lab2.grid(row=0,column=1,padx=5,pady=5)

lab3.grid(row=1,column=0,padx=5)

lab4.grid(row=1,column=1,padx=5)


window.mainloop()

# ch3_33.py

from tkinter import *


window = Tk()

window.title("ch3_33")              # 視窗標題

lab1 = Label(window,text="明志工專",relief="raised")

lab2 = Label(window,bg="yellow",width=20)

lab3 = Label(window,text="明志科技大學",relief="raised")

lab4 = Label(window,bg="aqua",width=20)

lab1.grid(row=0,column=0,padx=5,pady=5)

lab2.grid(row=0,column=1,padx=5,pady=5)

lab3.grid(row=1,column=0,padx=5)

lab4.grid(row=1,column=1,padx=5)


window.mainloop()


# ch3_34.py

from tkinter import *


window = Tk()

window.title("ch3_34")              # 視窗標題

lab1 = Label(window,text="明志工專",relief="raised")

lab2 = Label(window,bg="yellow",width=20)

lab3 = Label(window,text="明志科技大學",relief="raised")

lab4 = Label(window,bg="aqua",width=20)

lab1.grid(row=0,column=0,padx=5,pady=5,sticky=W+E)

lab2.grid(row=0,column=1,padx=5,pady=5)

lab3.grid(row=1,column=0,padx=5)

lab4.grid(row=1,column=1,padx=5)


window.mainloop()



沒有留言:

張貼留言

113 學年度第 1 學期 RFID應用課程 Arduino程式

113 學年度第 1 學期 RFID應用課程 Arduino程式 https://www.mediafire.com/file/zr0h0p3iosq12jw/MFRC522+(2).7z/file 內含修改過後的 MFRC522 程式庫 (原程式有錯誤) //定義MFRC522...