So I am making this GUI app with tkinter in which we can signup and login and save our data. I am having problem with getting the value from the Entry widget in my signup part.
from tkinter import *
##### CONSTANTS ############
m = Tk()
m.title("Info storage")
m.geometry("500x500")
############################
def signup():
sw = Toplevel()
sw.title("Sign Up")
signup_head = Label(sw, text="Sign Up over here!", font=font1, padx=180).grid(row=0, column=0)
username_text = Label(sw, text="Username", font=font2, pady=40).grid(row=1, column=0)
username = Entry(sw, width=40)
password_text = Label(sw, text="Password", font=font2, pady=10).grid(row=3, column=0)
password = Entry(sw, width=40)
re_password_text = Label(sw, text="Re-type your password", font=font2, pady=10).grid(row=5, column=0)
re_password = Entry(sw, width=40)
useless = Label(sw, text=" ", pady=50).grid(row=7, column=0)
username.grid(row=2, column=0)
password.grid(row=4, column=0)
re_password.grid(row=6, column=0)
def signup_work():
p = password.get()
my_p = Label(sw, text=p).pack()
go_btn = Button(sw, text="GO", width=20, command=signup_work).grid(row=8, column=0)
title = Label(m, text="Login or Signup to start storing your info!", width=50, height=3, font=font1).grid(row=0, column=0)
signup_button = Button(m, text="Sign Up", command=signup).grid(row=1, column=0)
m.mainloop()
This is the error that I am getting
Exception in Tkinter callback
Traceback (most recent call last):
File "F:\software\Python 3.9.7\lib\tkinter\__init__.py", line 1892, in __call__
return self.func(*args)
File "D:\Programming\Python\Tkinter\info-storage\main.py", line 38, in signup_work
my_p = Label(sw, text=p).pack()
File "F:\software\Python 3.9.7\lib\tkinter\__init__.py", line 2396, in pack_configure
self.tk.call(
_tkinter.TclError: cannot use geometry manager pack inside .!toplevel which already has slaves
managed by grid
I didn't even put a windows geometry function on my second window but i still get the same error.