Python: minor improvements

- Handle logouts gracefully, keep the login window open but hidden, and show it when necessary
- Minor edits in the help text
- Code reformatting