Reputation: 3908
What state must the window be in for these sizes to be valid? Hidden, maximized, minimized etc...
GetBestSize()
GetEffectiveMinSize()
GetMaxSize()
GetMinSize()
GetSize()
I find this very tricky as there are many size methods and I am not sure how they are used.
Upvotes: 0
Views: 173
Reputation: 6206
It's a little outdated but there is some info about the various size methods and related things at http://wiki.wxpython.org/WindowSizeInfo
Upvotes: 1
Reputation: 22688
These methods are all individually documented in the manual. This doesn't answer your question of how exactly are they used internally, but why do you need to know this? After all, you want to use them from outside wxPython, not from inside it.
My short guideline: if you need the size of the window, use GetSize()
. If you want to get the most appropriate size for the window, i.e. such that it will have just enough size for its contents, and you don't use sizers which ensure this automatically, for some reason, then use GetBestSize()
. You shouldn't need to call the other methods at all.
Upvotes: 1
Reputation: 2096
I think the best and most up to date documentation is the one for the wxPython Phoenix project.
http://wxpython.org/Phoenix/docs/html/Window.html?highlight=getsize#Window.GetBestSize
Most of that documentation also applies to the wxPython Classic version, especially if you use wxPython 2.9 or newer.
Note that all overloaded methods have different names in the Classic version where as in Phoenix there is just one name - most of this and more is documented here: http://wxpython.org/Phoenix/docs/html/classic_vs_phoenix.html
The wiki might also be helpful, in particular: wiki.wxpython.org/WindowSizeInfo
With regards to 2., as soon as the window/control is created you will get a value. Is that valid? Yes, but if you use sizers and if the layout is not yet updated you might get default values (0, 0) or (20, 20).
If you use sizers to control your layout you should never or very very rarely care about the size of a control.
Upvotes: 1