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()



沒有留言:

張貼留言

2024_09 作業3 以Node-Red 為主

 2024_09 作業3  (以Node-Red 為主  Arduino 可能需要配合修改 ) Arduino 可能需要修改的部分 1)mqtt broker  2) 主題Topic (發行 接收) 3) WIFI ssid , password const char br...