Setting Focus in Pmw.Dialog
Yael Raz
yaelr at locus.com.au
Tue Sep 19 03:29:25 EDT 2000
More information about the Python-list mailing list
Tue Sep 19 03:29:25 EDT 2000
- Previous message (by thread): Setting Focus in Pmw.Dialog
- Next message (by thread): Test Coverage Analysis for Python scripts
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Thanks Matt, that worked a treat! Yael. Matthew Dixon Cowles <matt at mondoinfo.com> wrote in message news:slrn8sdujn.m0.matt at happy-hour.mondoinfo.com... > On Tue, 19 Sep 2000 16:07:40 +1000, Yael Raz <yaelr at locus.com.au> > wrote: > > >A small but annoying problem with my first Python project: > > >I use Pmw.Dialog to prompt the user for some text. The dialog is > >just what I need, but for some reason I can't set the initial > >keyboard focus to the entry field. > > >The standard "askstring" dialog doesn't give me control over the edit > >field size (that I can see), so I tried this: > > > dialog = Pmw.Dialog( root, > > buttons = ( 'OK', ), > > buttonboxpos = S, > > title = 'Prompt' ) > > > > w = Pmw.EntryField( dialog.interior(), label_text = prompt, > > labelpos = NW,labelmargin = 1, entry_width = 50 ) > > w.pack( padx = 15, pady = 15 ) > > > > dialog.configure( activatecommand = w.focus_set ) > > dialog.focus_force() > > > > dialog.activate() > > Yael, > Your problem is that a Pmw.EntryField is itself a compound widget > (I've been caught by this one too). You want something like: > > dialog.configure( activatecommand = w.component("entry").focus_set ) > > You can also get a similar result by replacing > > dialog.configure( activatecommand = w.focus_set ) > dialog.focus_force() > > with > > w.component("entry").focus_force() > > Regards, > Matt
- Previous message (by thread): Setting Focus in Pmw.Dialog
- Next message (by thread): Test Coverage Analysis for Python scripts
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list