1

In the program I am creating, I need the user to be able to click the register/login button to move to the respective screen, I understand that I will need to use Tkinter frames to do this, but I am very lost on how to implement this.

So far, I have created the class that contains the current UI that I wish to be displayed when opening the program A design of the opening screen, but I am unsure on how to make the next page (A design of the intended next page) appear in the same window

from tkinter import *
from PIL import Image, ImageTk 
import sqlite3


database_conn=sqlite3.connect('flashcard_data.db')
database_cursor=database_conn.cursor()

program_root=Tk()

class program_ui:
  def __init__(self, program_window):
    self.program_window=program_window
    self.program_window.title('Flashcard Program')
    self.program_window.iconbitmap('flashcard_program_icon.ico')
    self.program_window.geometry('1248x702')
    self.program_title=Label(text="Flashcard Program", fg='#173A59', font=("Franklin Gothic Medium", 70))
    self.program_title.place(relx=0.5, rely=0.1, anchor='center')
    self.program_register_button=Button(text="Register", fg='#173A59', font=("Franklin Gothic Medium", 20))
    self.program_register_button.place(relx=0.5, rely=0.45, width=500, height=75, anchor='center')
    self.program_login_button=Button(text="Log in", fg='#173A59', font=("Franklin Gothic Medium", 20))
    self.program_login_button.place(relx=0.5, rely=0.65, width=500, height=75, anchor='center')
    
program_ui(program_root)
program_root.mainloop()
  • Just call ```pack_forget()``` for existing frames and ```pack()``` for the new frame. – relent95 Feb 06 '23 at 02:49
  • Take a look at this answe: https://stackoverflow.com/questions/7546050/switch-between-two-frames-in-tkinter/7557028#7557028 – Chris Feb 07 '23 at 08:43

0 Answers0