December 2015
Beginner to intermediate
350 pages
6h 49m
English
While our GUI is nicely improving, it would be more convenient and useful to have the cursor appear in the Entry widget as soon as the GUI appears. Here we learn how to do this.
This recipe extends the previous recipe.
Python is truly great. All we have to do to set the focus to a specific control when the GUI appears is call the focus() method on an instance of a tkinter widget we previously created. In our current GUI example, we assigned the ttk.Entry class instance to a variable we named nameEntered. Now we can give it the focus.
Place the following code just above the bottom of the module that starts the main windows event loop, just like in previous recipes. If ...
Read now
Unlock full access