Nictk 2.2.0
An easy to use pyton GUI
Getting widget informations

As said in the previous section, you can query many widget properties with the Nictk.Misc.get_config() method.

The get_winfo() method

For other properties tkinter has a long list of winfo... methods (one for every property we want to know). I reorganized them in one method Nictk.Misc.get_winfo() which, similarly to Nictk.Misc.get_config(), accepts the property as a string. For a list of all accepted options see the example file winfo.py. For the meaning of various tkinter winfo_... methods you can see this page, which elencates all tkinter general methods common to all widgets.

Retrieving widgets dimensions

In tkinter we can use the functions winfo_x (), winfo_y () etc. to find the dimensions of a widget, but these often create confusion, because they return the correct values only when the widget has been placed by the geometry manager.

In Nictk I left the general winfo... pattern only for methods getting widget dimensions, adding some new methods. These have been rewritten to always report the exact value, expressed in pixels. These are the methods (they all belong to the clas Nictk.Misc, inerithed by windows and internal widgets):

winfo_...() method get_winfo() method Returns Notes
winfo_bx() The bounding box topleft corner x These are the dimensions of the bounding box of the widget (before applying the pad to it). They are used by the library when packing widgets (i.e. the bounding boxes, not the real widgets, are packed).
winfo_by() The bounding box topleft corner y
winfo_bwidth(), winfo_bw() The bounding box width
winfo_bheight(), winfo_bh() The bounding box height
winfo_x() get_winfo("x") The widget topleft corner x These are the real widget dimensions, after applying the pad to the bounding box.
winfo_y() get_winfo("y") The widget topleft corner y
winfo_width(), winfo_w() get_winfo("width") The widget width
winfo_height(), winfo_h() get_winfo("height") The widget height
winfo_bpad() A tuple with the four pad values (E-N-W-S) for the widget int its bounding box

You can also see the winfo.py file for an example of the use of these methods.