I have so far discovered four discovered width (or height) related methods and properties of widget (some for them also can be used to get other widget properties). What are the differences between all of them?
widget["width"]
widget.cget("width")
widget.winfo_width()
widget.winfo_reqwidth()
(There are also equivalent methods and properties for height).
widget["width"]
is just a wrapping of some of the other commands, I can't tell you which one without decompiling the functionwidget.cget("width")
is a method to access to variable width using the access to widget object through the getters methods of the objectwidget.winfo_width()
can be used to know the current width asking to TK's windows managerwidget.winfo_reqwidth()
can tell you how much the width
of the widget was originally when it was opened, before the widget.update_idletasks()
methodIn general, we can say that they all do the same thing but, as you can guess, there are subtle differences that allow you to access the information you are looking for differently, in this case width.