12.07.2015 Views

Tkinter reference: A GUI for Python

Tkinter reference: A GUI for Python

Tkinter reference: A GUI for Python

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

w.destroy()Calling w.destroy() on a widget w destroys w and all its children.w.event_add ( virtual, *sequences )This method creates a virtual event whose name is given by the virtual string argument.Each additional argument describes one sequence, that is, the description of a physicalevent. When that event occurs, the new virtual event is triggered.See Events, below, <strong>for</strong> a general description of virtual events.w.event_delete ( virtual, *sequences )Deletes physical events from the virtual event whose name is given by the string virtual.If all the physical events are removed from a given virtual event, that virtual event won’thappen anymore.w.event_generate ( sequence, **kw )This method causes an event to trigger without any external stimulus. The handling ofthe event is the same as if it had been triggered by an external stimulus. The sequenceargument describes the event to be triggered. You can set values <strong>for</strong> selected fields inthe Event object by providing keyword=value arguments, where the keyword specifies thename of a field in the Event object.See Events, below, <strong>for</strong> a full discussion of events.w.event_info ( virtual=None )If you call this method without an argument, you’ll get back a sequence of all the currentlydefined virtual event names.To retrieve the physical events associated with a virtual event, pass this method the nameof the virtual event and you will get back a sequence of the physical sequence names,or None if the given virtual event has never been defined.w.focus_displayof()Returns the name of the window that currently has input focus on the same display asthe widget. If no such window has input focus, returns None.See Focus, below, <strong>for</strong> a general description of input focus.w.focus_<strong>for</strong>ce()Force the input focus to the widget. This is impolite. Better to wait <strong>for</strong> the windowmanager to give you the focus.w.focus_get()Get the name of the widget that has focus in this application, if any—otherwise returnNone.w.focus_last<strong>for</strong>()This method retrieves the name of the widget that last had the input focus in the top-levelwindow that contains w. If none of this top-level’s widgets have ever had input focus,it returns the name of the top-level widget. If this application doesn’t have the inputfocus, the .focus_last<strong>for</strong>() method will return the name of the widget that will getthe focus next time it comes back to this application.New Mexico Tech Computer Center <strong>Tkinter</strong> <strong>reference</strong>: Universal widget methods Page 63

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!