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.winfo_pathname ( id, displayof=0 )If the displayof argument is false, returns the “widget path name” of the widget withunique identifier id in the application’s main window. If displayof is true, the idnumber specifies a widget in the same top-level window as w. Under .winfo_id(),above, you will see how to obtain a widget’s identifier; under .winfo_name(), above, isan explanation of widget path names.w.winfo_pixels ( number )For any dimension number (see Dimensions, above), this method returns that distance inpixels on w’s display, as an integer.w.winfo_pointerx()w.winfo_pointery()w.winfo_pointerxy()The first two methods return the x and y coordinates, respectively, of the mouse pointerrelative to w’s root window. If the mouse pointer isn’t on the same screen, each willreturn -1. The third method returns a tuple (x, y), or (-1, -1).w.winfo_reqheight()w.winfo_reqwidth()These methods return the requested height and width, respectively, of widget w. Thesedimensions are the ones necessary so that all of w’s contents have the room they need.The actual height and width may be different due to negotiations with the geometrymanager.w.winfo_rgb ( color )For any given color (see Colors, above, <strong>for</strong> the various ways of specifying colors), thismethod returns the equivalent red-green-blue color specification as a 3-tuple (r, g, b),where each number is an integer in the range [0; 65536]. For example, if the color is"green", this method returns the 3-tuple (0, 65535, 0).w.winfo_rootx()w.winfo_rooty()Returns the x and y coordinates, respectively, of the upper left-hand corner of w’s rootwindow relative to w’s parent. If w has a border, this is the outer corner of the border.w.winfo_screenheight()w.winfo_screenwidth()w.winfo_screenmmheigh()w.winfo_screenmmwidth()These methods retrieve the size of the screen. The first two return the height and width,respectively, in pixels. The latter two return the screen size in millimeters, as an integer.w.winfo_screenvisual()Returns a string that describes the display’s method of color rendition. This is usually"truecolor" <strong>for</strong> 16- or 24-bit displays, "pseudocolor" <strong>for</strong> 256-color displays.w.winfo_toplevel()Returns the top-level window containing w. That window supports all the methods onToplevel widgets; see the section on Toplevel, above.New Mexico Tech Computer Center <strong>Tkinter</strong> <strong>reference</strong>: Universal widget methods Page 68

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

Saved successfully!

Ooh no, something went wrong!