Question

I have written a simple and yet basic interface for an imaginary DVD Shop for learning Python with PyGTK. The current stage is at writing a simple user center.

When you execute this file, the first "Login + Logout" is acting correctly, but when you decide to login the second time with same/different account, it behaved as if it's still logged out, but the "Login" button has been changed to "Logout".

Code has been truncated to what's needed.

Please help me, I am new to Python and PyGTK. Thanks.

File link: http://pastebin.com/eK7z7S48

Was it helpful?

Solution

The problem is due to overwriting a class variable with an instance variable

If you are setting DVDshop.loggedIn instead of self.loggedIn your code will work as expected.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top