문제

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

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top