tkSimpleDialog window focus problem

I

inkhorn

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
 
I

inkhorn

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,783
Latest member
RickeyDort

Latest Threads

Top