2.6.1 Default Widget Focus

An important usability aspect of an application is having focus set by default to the widget where it is most useful, so the user can start working right away without having to tab his way through the window's widgets. If you pay attention, when you first start the faren.py example, the gtk.Entry for temperature starts with the cursor focus; I've set the "Has focus" property to True for that widget in Glade. show*_and_loop() checks your interface before running; if there is an interactive widget attached to it, and none of the View's widgets is focused, it prints a warning to standard error explaining the View doesn't have an interactive widget focused:

    Kiwi warning: no widget is focused in view
        <__main__.FarenView instance at 0x8335444>
    but you have an interactive widget in it:
        <Kiwi.Basic.Entry instance at 0x8774f14>

Setting the focused widget in Glade may seem unobvious; if so, you have alternatives to set focus programatically:

When using UI composition, remember that the slave view will lose its focus state when the function attach_slave() is run, so if you wish to focus a widget that is part of the slave, you will need to do it explicitly after that function call. If the widget to be focused is in the parent view, you should have no problems (unless you are swapping *that* particular widget for the slave, of course).