Tkinter มีลำดับชั้นคลาสที่แน่นอน ซึ่งมีฟังก์ชันและเมธอดในตัวมากมาย เมื่อเราสร้างแอปพลิเคชัน เราใช้ฟังก์ชันเหล่านี้เพื่อสร้างโครงสร้างคอมโพเนนต์ คลาส wm ย่อมาจาก "window manager" ซึ่งเป็น mixin คลาสที่ให้ฟังก์ชันและเมธอดในตัวมากมาย
เมธอด wm_title() ใช้เปลี่ยนชื่อเรื่องของหน้าต่าง Tkinter แต่เราสามารถใช้ win.title() ได้เช่นกัน โดยทั่วไป คลาส wm ให้เมธอดที่ทำให้เราสื่อสารกับบริการหน้าต่างได้
ตัวอย่าง
# Import the required libraries
from tkinter import *
# Create an instance of tkinter frame or window
win = Tk()
# Set the size of the window
win.geometry("700x350")
win.wm_title("This is the Title")
# Add A label widget
Label(win, text="Welcome to TutorialsPoint✨ \n" "You are browsing the best resource for Online Education.", font=('Aerial 18 italic')).place(x=50, y=150)
win.mainloop()ผลลัพธ์
รันโค้ดเพื่อแสดงหน้าต่างที่มี Label text widget
