PMW widget - skip tabbing to it

kyosohma at gmail.com kyosohma at gmail.com
Mon Mar 26 14:22:08 EDT 2007


On Mar 26, 1:17 pm, "jp" <johnpe... at yahoo.com> wrote:
> On Mar 26, 12:34 pm, kyoso... at gmail.com wrote:
>
>
>
> > On Mar 26, 11:35 am, "jp" <johnpe... at yahoo.com> wrote:
>
> > > On Mar 26, 11:27 am, kyoso... at gmail.com wrote:> On Mar 26, 11:17 am, kyoso... at gmail.com wrote:
>
> > > > > On Mar 26, 10:51 am, "jp" <johnpe... at yahoo.com> wrote:
>
> > > > > > I have multiple PMW widgets (EntryFields, ScrolledField etc), how can
> > > > > > I skip over these widgets when using the tab key?
>
> > > > > > Thank you,
> > > > > > John
>
> > > > > I would probably write some custom event handling. Something that
> > > > > could tell it was a key-press event and not just an on-focus event.
> > > > > Then it would be a simple, if key-press == tab, put focus on next
>
> > > #> > widget of interest. Something like that should work.
>
> > > > > Mike
>
> > > > I looked in my Tkinter book, and it says that if the widget has the
> > > > "takefocus" option set to true, the widget is placed in the tab group
> > > > and will get focus when they are tabbed to. I assume that this means
> > > > if you set the PMW widgets' "takefocus" option to false, they will be
> > > > skipped over since they won't be in the tab group.
>
> > > > Mike
>
> > > I've tried using the takefocus option set to 0 and 1 but either way,
> > > the tab key still stops at my EntryField.  Below is my snippet of
> > > code.  What am I doing wrong?
>
> > > entry=Pmw.EntryField(frame,
> > >                      labelpos = 'w',
> > >                      value = "",
> > >                      label_text =
> > > 'Name:')
> > > entry.grid(row=1)
> > > #entry.component('entry').takefocus = 1
> > > entry.component('entry').takefocus = 0
>
> > According to the Tkinter book, setting takefocus to 0 (false) should
> > work. Are you putting th EntryField into a Grid? If so, that might be
> > the problem. I suppose the grid may override its children's settings.
>
> > I've never messed too much with skipping widgets in the tab order. You
> > could pack the PMW widgets last so that they won't get tabbed to until
> > the end.
>
> > There's also tk_focusNext & tk_focusPrev. See the following post for
> > more info and ideas:
>
> >http://www.dbforums.com/archive/index.php/t-1377788.html
>
> > Mike
>
> I am using a grid, but even using pack() the takefocus=0 doesn't
> work.  The tab key still moves to my EntryField.
> I'll look into the focusNext and focusPrev that you suggested.  Thanks!

Oops. Sorry. When I said grid, I was thinking that Tkinter had a grid
widget. I had forgotten they called one of there sizer/place
management options "grid". Sorry about that. I use wxPython as much as
possible.

Mike




More information about the Python-list mailing list