Shai Shmuel
Shai Shmuel

Reputation: 3

"Parameter 'self' unfilled" when using ".get()

I am writing a Login / Registration code for an online course I am developing.

When trying to write one of the functions that enter the "user name" & "password", it seems like I cannot use .get() function because Pycharm shows me an error - "Parameter 'self' unfilled".

I already used it in my code for the registration part, no problems were seen.

My code (the part of the function that makes the issues):

def login():
    global screen2
    screen2 = Toplevel(screen)
    screen2.title("Login")
    screen2.geometry("300x250")
    Label(screen2, text="Please Enter your Login details").pack()
    Label(screen2, text="").pack()

    global username_verify
    global password_verify
    global username_entry1
    global password_entry1

    username_verify = StringVar
    password_verify = StringVar

    Label(screen2, text="Username").pack()
    username_entry1 = Entry(screen2, textvariable=username_verify)
    username_entry1.pack()
    Label(screen2, text="").pack()
    Label(screen2, text="Password").pack()
    password_entry1 = Entry(screen2, textvariable=password_verify)
    password_entry1.pack()
    Label(screen2, text="").pack()
    Button(screen2, text="Login", width=10, height=1, command=login_verify).pack()

    c_1 = username_verify.get()
    c_2 = password_verify.get()

I added c_1 and c_2 just to try and solve the issues but no luck so far (it marked me in pycharm in yellow the parenthesis of the both .get() modules.

error I receive within my pycharm (before 'Run'):

error I receive within my pycharm (before 'Run')

error I receive within my pycharm (after 'Run'):

error I receive within my pycharm (after 'Run')

Thanks for your help.

Upvotes: 0

Views: 2331

Answers (1)

Bryan Oakley
Bryan Oakley

Reputation: 385970

You aren't using StringVar properly. username_verify = StringVar does not create an object of type StringVar, it just makes username_verify the same as StringVar.

The proper way to create an instance of StringVar is like this:

username_verify = StringVar()

Also, your use of StringVar is completely unnecessary. The entry widget itself has a get method. You can reduce the complexity of your code by simply not using StringVar or textvariable at all.

Upvotes: 2

Related Questions