Upgrade or not ??

Greg McFarlane Greg.McFarlane at p98.f112.n480.z2.fidonet.org
Sun Jul 4 08:49:12 EDT 1999


From: Greg McFarlane <gregm at iname.com>

Depending on exactly what you want to do, it may be possible in
Tkinter.  You can use something like this to find out when a widget
gets and loses focus:

    import Tkinter

    def gotFocus(event):
	print 'Focus in'
    def lostFocus(event):
	print 'Focus out'

    root = Tkinter.Tk()

    e = Tkinter.Entry()
    e.bind('<FocusIn>', gotFocus)
    e.bind('<FocusOut>', lostFocus)
    e.pack()

    root.mainloop()

Also, you can use this to set the focus to a widget.

    e.focus_set()

On 3 Jul, pierrette wrote:
> First a general question :
> Actually we're working with Python 1.5.1 and we're satisfied with it.
> Should we upgrade to 1.5.2 and if yes WHY?
> 
> No a Tkinter guestion :
> We developped a prototype of an application with python an tkinter, now
> we have to
> decide if we're gonna write the real app in python or something else !
> We now allready that in principle we could do it with python, the thing
> we're missing
> in tk is a 'on get focus' ,a 'on lost focus' event and a 'set focus to'
> command
> Pe: on lost focus of inputfield 1:
>             if inputfield1 = A:
>                 set focus to field2
>             elif inputfield1 = B:
>                 set focus to field 3
> 
> If those things are not available in tkinter what alternatives do we
> have ?
> - Changing the GUI (would be a shame but feasable), knowing that is has
> to be multi-platform WIN-LINUX? If so to what ?
> - Not write in python ? In this case we lose the work done for the
> prototype
> 
> Thanks for comments and remarks
> 
> Pierrette Serrand
> pserrand at worldnet.fr
> 
> 
> 
> 
> 

-- 
Greg McFarlane:    INMS Telstra Australia (gregm at nms.otc.telstra.com.au)
Today's forecast:  Sunny, with occasional cloudy periods and a chance
		   of precipitation in some areas.




More information about the Python-list mailing list