2022年11月16日 星期三

Python GUI 標籤 Label ---- EX2.1 , 2.2 , 2.2.1

 # ch2_1.py

from tkinter import *


root = Tk()

root.title("ch2_1")

label=Label(root,text="I like tkinter")

label.pack()        # 包裝與定位元件

print(type(label))  # 傳回Label物件

root.mainloop()




# ch2_2.py

from tkinter import *


root = Tk()

root.title("ch2_2")

label=Label(root,text="I like tkinter").pack()

print(type(label))  # 傳回Label物件

root.mainloop()







>>> %Run ch2_2.py

<class 'NoneType'>



# ch2_2_1.py

from tkinter import *


root = Tk()

root.title("ch2_2_1")

Label(root,text="I like tkinter").pack()  


root.mainloop()



沒有留言:

張貼留言

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

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