Tiltle bar and menu bar and border sizes

77 views
Skip to first unread message

Bruce Sherwood

unread,
Oct 29, 2012, 2:17:44 PM10/29/12
to wxpytho...@googlegroups.com
Is there a way to find out the heights of the title and menu bars, and the width of the window borders? For example, I tried GetSizeTuple for a menubar and got two gigantic integers, one of them negative. I need the numbers because the user of my library is supposed to be able to specify the outer size of a window which includes the title bar, the menu bar, and the window borders, and the user may want to know the dimensions of the remainder. I could presumably hard-code values dependent on platform, but that's obviously not optimal.

Chris Weisiger

unread,
Oct 29, 2012, 2:29:41 PM10/29/12
to wxpytho...@googlegroups.com
I'm not certain I follow your use case, but would the difference
between GetSize() and GetClientSize() be helpful? The latter is the
"usable size" to put widgets into, while the former includes title
bars and borders.

-Chris

Cody

unread,
Oct 29, 2012, 2:38:15 PM10/29/12
to wxpytho...@googlegroups.com
Hello,
See the SystemSettings sample in the wxPython demo application. In
particular the GetMetric method and related constants.


Cody

Robin Dunn

unread,
Oct 29, 2012, 3:29:48 PM10/29/12
to wxpytho...@googlegroups.com
You can look at the difference between GetSize() and GetClientSize() to
get a good estimate of the size of the frame decorations plus any "bars"
in the frame.

I think there was an issue related to this on wxGTK up to 2.8, because
getting the actual size of the caption bar and such was done in an
unreliable way, but that is supposed to have been fixed in 2.9. The
other platforms should give you accurate sizes.


--
Robin Dunn
Software Craftsman
http://wxPython.org

Bruce Sherwood

unread,
Oct 29, 2012, 7:16:22 PM10/29/12
to wxpytho...@googlegroups.com
Thanks. That works on Windows; it will be a while before I'm set up to test on other platforms. This is easier than getting the individual pieces from SYS_FRAMESIZE_X etc. though I'm glad to know about GetMetric.
Reply all
Reply to author
Forward
0 new messages