2022年11月17日 星期四

Python GUI 配置管理員pack() EX3.26 , 3.27 , 3.28 , 3.29 , 3.30

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


# ch3_27.py

from tkinter import *


window = Tk()

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

lab1 = Label(window,text="標籤1",relief="raised")

lab2 = Label(window,text="標籤2",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,columnspan=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()


# ch3_28.py

from tkinter import *


window = Tk()

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

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

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,rowspan=2)

lab3.grid(row=0,column=2)

lab4.grid(row=0,column=3)

lab5.grid(row=1,column=0)

lab7.grid(row=1,column=2)

lab8.grid(row=1,column=3)


window.mainloop()

# ch3_29.py

from tkinter import *


window = Tk()

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

lab1 = Label(window,text="標籤1",relief="raised")

lab2 = Label(window,text="標籤2",relief="raised")

lab4 = Label(window,text="標籤4",relief="raised")

lab5 = Label(window,text="標籤5",relief="raised")

lab8 = Label(window,text="標籤8",relief="raised")

lab1.grid(row=0,column=0)

lab2.grid(row=0,column=1,rowspan=2,columnspan=2)

lab4.grid(row=0,column=3)

lab5.grid(row=1,column=0)

lab8.grid(row=1,column=3)


window.mainloop()

# ch3_30.py

from tkinter import *


window = Tk()

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

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,padx=5,pady=5)

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

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

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

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

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

lab7.grid(row=1,column=2,padx=5)

lab8.grid(row=1,column=3,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...