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.selection_own()Make w the owner of the selection in w’s display, stealing it from the previous owner, ifany.w.selection_own_get()Returns the widget that currently owns the selection in w’s display. Raises TclError ifthere is no such selection.w.tk_focusFollowsMouse()Normally, the input focus cycles through a sequence of widgets determined by theirhierarchy and creation order; see the section on Focus, below. You can, instead, tell<strong>Tkinter</strong> to <strong>for</strong>ce the focus to be wherever the mouse is; just call this method. There is noeasy way to undo it, however.w.unbind ( sequence, funcid=None )This method deletes bindings on w <strong>for</strong> the event described by sequence. If the secondargument is a callback bound to that sequence, that callback is removed and the rest, ifany, are left in place. If the second argument is omitted, all bindings are deleted.See Events, below, <strong>for</strong> a general discussion of event bindings.w.unbind_all ( sequence )Deletes all event bindings throughout the application <strong>for</strong> the event described by the givensequence.w.unbind_class ( className, sequence )Like .unbind(), but applies to all widgets named className (e.g., "Entry" or "Listbox").w.update()This method <strong>for</strong>ces the updating of the display. It should be used only if you know whatyou’re doing, since it can lead to unpredictable behavior or looping. It should never becalled from an event callback or a function that is called from an event callback.w.update_idletasks()Some tasks in updating the display, such as resizing and redrawing widgets, are called“idle tasks” because they are usually deferred until the application has finished handlingevents and has gone back to the main loop to wait <strong>for</strong> new events.If you want to <strong>for</strong>ce the display to be updated be<strong>for</strong>e the application next idles, call thew.update_idletasks() method on any widget.w.winfo_children()Returns a list of all w’s children, in their stacking order from lowest (bottom) to highest(top).w.winfo_class()Returns w’s class name (e.g., "Button").w.winfo_colormapfull()Returns true if w’s window’s color map is full, that is, if the last attempt to add a color toit failed and no colors have been removed since then.New Mexico Tech Computer Center <strong>Tkinter</strong> <strong>reference</strong>: Universal widget methods Page 66

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

Saved successfully!

Ooh no, something went wrong!