[Tutor] login window using Tk
Wayne Werner
waynejwerner at gmail.com
Tue Nov 1 20:54:20 CET 2011
On Tue, Nov 1, 2011 at 1:57 PM, Chris Hare <chare at labr.net> wrote:
> Here is a code snippet I have pulled out of the project. It is as bare
> bones as I can make it to get the point across.
>
> the problems I am having:
>
> 1. I would really like the window to be centered in the user's screen,
> but setting the geometry doesn't place it there. (that isn't included here)
>
Take a look at the winfo_screenwidth/height methods.
> 2. When I click the Login button, nothing happens. I know I am missing
> something but it just isn't obvious what it is.
>
In your code you have "print button pressed" as the command - this is a
string, and certainly wont do anything useful - you want to put a function
here, e.g. command=self.login or something to that effect. You don't want
parenthesis, or it will try to login as soon as python creates your button.
> 3. Finally, I would like to be able to hide the root window until the
> authentication is performed, but root.hide() gets me a getattr error.
> root.withdraw() works, but I can't get the root window back
>
root.deiconify() is the method you're looking for here.
HTH,
Wayne
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20111101/18a0f353/attachment.html>
More information about the Tutor
mailing list