Help with this part of code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Help with this part of code

""" want to go to a new window if the password is correct but don't know how, if I put # lambda: controller.show_frame(pageone)) inside the button, it will go without checking the password" class StartPage(tk.frame): def loginusr (self): name = self.usrname_entry.get() pw = self.password_entry.get() def cross-check(): sql = ('SELECT password FROM kng WHERE Name = %s',(name)) af = a.execute(*sql) data = a.fetchone() return data[0] try: p = cross-check() except TypeError: tkinter.messagebox.showinfo("loginpg","error") if pw == p: tkinter.messagebox.showinfo("loginpg","login successful") else: tkinter.messagebox.showwarning("loginpg","Username or password is incorrect") #button Self.loginbutton = tk.Button(self, active background="#ececec"...command =self.loginUser) self.loginbutton.place(relx= ...)

17th May 2019, 5:08 PM
Joseph Ojo
Joseph Ojo - avatar
4 Answers
+ 1
I am no good in tkinter, but i have experience with Swing. Can you try creating your notice but "HIDE" until the password is validated? That can act as a welcome screen.
15th Nov 2019, 9:22 AM
Anirudh Sharma
Anirudh Sharma - avatar
+ 1
Anirudh Sharma I found an answer later, after searching through the net. Thank you
16th Nov 2019, 12:50 PM
Joseph Ojo
Joseph Ojo - avatar
0
So can you please share your answer, it would be helpful to me and anyone else in the future who would face similar issues.
16th Nov 2019, 3:24 PM
Anirudh Sharma
Anirudh Sharma - avatar
0
Can't find the code file and I can't remember but I'm planning on writing it again, so I'll share it when I'm done
18th Nov 2019, 3:40 PM
Joseph Ojo
Joseph Ojo - avatar