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



沒有留言:

張貼留言

Messaging API作為替代方案

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