0

Absolutely newbie in Python. Statement is satisfied as user exist in DB so program prints "DETAILS CORRECT" but also I would like it to jump to next window (made in PyQt5) by going through next function. Is that correct? def function2

    else:
        cur = conn.cursor()
        query = 'SELECT customer_password FROM customers_table WHERE customer_login =\'' + customerlogin + "\'"
        cur.execute(query)
        result_pass = cur.fetchone()[0]
        if result_pass == customerpassword:
            def function2():   
        self.errorlabel.setText("DETAILS CORRECT")
        else:
            self.errorlabel.setText("PLEASE CHECK DATA OR REGISTER")
1
  • 1
    What is your issue regarding the code? Does it work according to your expectation? Commented Jan 17, 2022 at 21:37

1 Answer 1

2

You need to call the function not define it, you define it somewhere else:

def func2():
    ...

...

if result_pass == customerpassword:
    self.errorlabel.setText("DETAILS CORRECT")
    func2()     
else:
    self.errorlabel.setText("PLEASE CHECK DATA OR REGISTER")
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.