Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

How to change frame in tkinter

from tkinter import *


def raise_frame(frame):
    frame.tkraise()

root = Tk()

f1 = Frame(root)
f2 = Frame(root)
f3 = Frame(root)
f4 = Frame(root)

for frame in (f1, f2, f3, f4):
    frame.grid(row=0, column=0, sticky='news')

Button(f1, text='Go to frame 2', command=lambda:raise_frame(f2)).pack()
Label(f1, text='FRAME 1').pack()

Label(f2, text='FRAME 2').pack()
Button(f2, text='Go to frame 3', command=lambda:raise_frame(f3)).pack()

Label(f3, text='FRAME 3').pack(side='left')
Button(f3, text='Go to frame 4', command=lambda:raise_frame(f4)).pack(side='left')

Label(f4, text='FRAME 4').pack()
Button(f4, text='Goto to frame 1', command=lambda:raise_frame(f1)).pack()

raise_frame(f1)
root.mainloop()
Comment

PREVIOUS NEXT
Code Example
Python :: rename in python 
Python :: python sort dictionary by value 
Python :: python tkinter projects 
Python :: pandas column rank 
Python :: python thread function 
Python :: how to create a variablein python 
Python :: if statement in one-line for loop python 
Python :: how to convert .ui file to .py 
Python :: how to write pretty xml to a file python 
Python :: pygame point at mouse 
Python :: python print value and variable name 
Python :: how to fix valueerror in python 
Python :: handle 404 in requests python 
Python :: django production 
Python :: python fill zeros left 
Python :: primary key auto increment python django 
Python :: remove from string python 
Python :: how to restart loop python 
Python :: python int to string 
Python :: def extract_title(input_df): 
Python :: python keyboard key codes 
Python :: pandas reset index 
Python :: python list comprehension 
Python :: how to print keys and values of dictionary together in python? 
Python :: roblox api python 
Python :: make legend box transparent in matplotlib 
Python :: convert plt image to numpy 
Python :: python sets 
Python :: huggingface dataset from pandas 
Python :: python create array 
ADD CONTENT
Topic
Content
Source link
Name
6+5 =