ফ্রেম স্যুইচিং টেকনিক
দুটি ফ্রেম তৈরি করুন এবং pack()/pack_forget() ব্যবহার করে স্যুইচ করুন।
উদাহরণ
from tkinter import *
from tkinter import font
win = Tk()
win.geometry("700x350")
greet = Frame(win)
order = Frame(win)
def change_to_greet():
greet.pack(fill='both', expand=1)
order.pack_forget()
def change_to_order():
order.pack(fill='both', expand=1)
greet.pack_forget()
font1 = font.Font(family='Georgia', size='22', weight='bold')
font2 = font.Font(family='Aerial', size='12')
Label(greet, text="Hey There! Welcome to TutorialsPoint.", foreground="green3", font=font1).pack(pady=20)
Label(order, text="Find all the interesting Tutorials.", foreground="blue", font=font2).pack(pady=20)
Button(win, text="Switch to Greet", font=font2, command=change_to_order).pack(pady=20)
Button(win, text="Switch to Order", font=font2, command=change_to_greet).pack(pady=20)
win.mainloop()
আউটপুট
দুটি বাটন দিয়ে "Greet" এবং "Order" ফ্রেমের মধ্যে স্যুইচ করা যাবে।