Ask coding questions

← Back to all posts
issues with an assignment
AustinMoore4 (0)

I need help with an assignment containing Tkinter. the instructions are
1. Create a repl.it tkinter program. Copy your code from your first login program.

  1. Create a dictionary that stores usernames and passwords as follows:

users = { "theatrechick25" : "2Bornot2B", "soccerGuy2024" : "getYourKick$"}

  1. Comment out the command that added the "hidden" label to the grid. You'll want to use this later!

  2. Now create a function login() that:

stores the values of the username and password entries as variables
checks to see if a username is in the users dictionary (you can do this with the in command)
if it is, check to see if the password matches the password in the dictionary
If the username or password is incorrect, change the text of the hidden label to "Invalid username or password" and add it to the grid at its previous location
If the username and password are both valid:
change the text of the hidden label to "Login Successful" and add it to the grid at its previous location
hide the "invalid username or password" label with __.get_forget()
5. On the login button, change the value of the command to be login, so that when this button is pressed, it calls login().
i got the majority of this done but have ran into a wall. can someone help me

Answered by Axrevyn (290) [earned 5 cycles]
View Answer
Comments
hotnewtop
Axrevyn (290)

google is your friend

AustinMoore4 (0)

i tried google. i am getting an issue with the line 10. i get an attribute error no matter what I do @Axrevyn

Axrevyn (290)

@AustinMoore4 Ah, that error.
.get() is only used for lists, while username is a string, so it throws an error.