tkSimpleDialog window focus problem

inkhorn matt.dubins at sympatico.ca
Thu Feb 5 15:40:29 EST 2009


After much tinkering, I figured out the problem.  Before the call to
the ftp.login function, I had another simpledialog asking for a
userid.  The focus was leaving the parent Tk window altogether right
after userid entry.  So, right after the call to obtain the userid
from the user, i called the Frame.focus_force() method.  Observe:

self.userid = tkSimpleDialog.askstring("UTSCID Entry","UTSCID:")
self.focus_force()

Now, the next tkSimpleDialog.askstring call that I made ACTUALLY gets
the keyboard focus automatically.

Cheers,
Matt


On Feb 4, 10:21 am, inkhorn <matt.dub... at sympatico.ca> wrote:
> Hi all,
>
> As part of the program I've created and am maintaining, the user has
> to type in his/her username and password into tkinter simple dialog
> windows.  What you'll see below is that I've nested an askstring
> dialog window within a call to use the ftp module to login to an FTP
> server.
>
> result = self.ftp.login(self.userid, tkSimpleDialog.askstring
> ("Password Entry",
>                                               "Password:", show="*"))
>
> Annoyingly, every time this password entry window pops up, the focus
> does not go on it automatically.  Anyone know what I can do to put the
> focus on it automatically, while *not* storing the user's password in
> my script for the remainder of its runtime?
>
> Thanks,
> Matt Dubins




More information about the Python-list mailing list