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



















沒有留言:

張貼留言

Messaging API作為替代方案

  LINE超好用功能要沒了!LINE Notify明年3月底終止服務,有什麼替代方案? LINE Notify將於2025年3月31日結束服務,官方建議改用Messaging API作為替代方案。 //CHANNEL_ACCESS_TOKEN = 'Messaging ...