2022年11月17日 星期四

Python GUI 配置管理員pack() EX3.12 , 3.13

 # ch3_12.py

from tkinter import *

root = Tk()

root.title("ch3_12")

root.geometry("300x180")            # 設定視窗勘寬300高180

oklabel=Label(root,text="OK",       # 標籤內容是OK

              font="Times 20 bold", # Times字型20粗體

              fg="white",bg="blue") # 藍底白字

oklabel.pack(anchor=S,side=RIGHT,   # 從右開始在南方配置

             padx=10,pady=10)       # x和y軸間距皆是10


root.mainloop()


# ch3_13.py

from tkinter import *


root = Tk()

root.title("ch3_13")

root.geometry("300x180")            # 設定視窗勘寬300高180

oklabel=Label(root,text="OK",       # 標籤內容是OK

              font="Times 20 bold", # Times字型20粗體

              fg="white",bg="blue") # 藍底白字

oklabel.pack(anchor=S,side=RIGHT,   # 從右開始在南方配置

             padx=10,pady=10)       # x和y軸間距皆是10

nolabel=Label(root,text="NO",       # 標籤內容是OK

              font="Times 20 bold", # Times字型20粗體

              fg="white",bg="red")  # 藍底白字

nolabel.pack(anchor=S,side=RIGHT,   # 從右開始在南方配置

             pady=10)               # y軸間距皆是10


root.mainloop()











沒有留言:

張貼留言

2024產專班 作業2 (純模擬)

2024產專班 作業2  (純模擬) 1) LED ON,OFF,TIMER,FLASH 模擬 (switch 控制) 2)RFID卡號模擬 (buttom  模擬RFID UID(不從ESP32) Node-Red 程式 [{"id":"d8886...