2022年11月16日 星期三

Python GUI 標籤 Label ---- EX2.7 , 2.8 , 2.9 , 2.10 , 2.11 , 2.12

 # ch2_7.py

from tkinter import *


root = Tk()

root.title("ch2_7")

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

            fg="blue",bg="yellow",

            height=3,width=15,

            anchor="nw",

            wraplength = 40)

label.pack()  


root.mainloop()


# ch2_8.py

from tkinter import *


root = Tk()

root.title("ch2_8")

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

            fg="blue",bg="yellow",

            height=3,width=15,

            font="Helvetica 20 bold")

label.pack()  


root.mainloop()


# ch2_9.py

from tkinter import *


root = Tk()

root.title("ch2_9")

label=Label(root,text="abcdefghijklmnopqrstuvwy",

            fg="blue",bg="lightyellow",

            wraplength=80)

label.pack()  


root.mainloop()


# ch2_10.py

from tkinter import *


root = Tk()

root.title("ch2_10")

label=Label(root,text="abcdefghijklmnopqrstuvwy",

            fg="blue",bg="lightyellow",

            wraplength=80,

            justify="left")

label.pack()  


root.mainloop()



# ch2_11.py

from tkinter import *


root = Tk()

root.title("ch2_11")

label=Label(root,text="abcdefghijklmnopqrstuvwy",

            fg="blue",bg="lightyellow",

            wraplength=80,

            justify="center")

label.pack()  


root.mainloop()


# ch2_12.py

from tkinter import *


root = Tk()

root.title("ch2_12")

label=Label(root,text="abcdefghijklmnopqrstuvwy",

            fg="blue",bg="lightyellow",

            wraplength=80,

            justify="right")

label.pack()  


root.mainloop()




沒有留言:

張貼留言

Telegram +ESP32自動發報機

  Telegram   +ESP32自動發報機 這套系統是一個典型的 IoT(物聯網)架構 ,結合了遠端配置(Python)、通訊中介(MQTT)與硬體執行(ESP32)。 以下我為您拆解這兩支程式的核心運作原理: 一、 系統架構流程 Python 端 (控制台) :使用者輸入...