Tiltle bar and menu bar and border sizes

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.

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

···

On Mon, Oct 29, 2012 at 11:17 AM, Bruce Sherwood <bruce.sherwood@gmail.com> wrote:

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.

Hello,

···

On Mon, Oct 29, 2012 at 1:17 PM, Bruce Sherwood <bruce.sherwood@gmail.com> wrote:

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.

See the SystemSettings sample in the wxPython demo application. In
particular the GetMetric method and related constants.

Cody

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.

···

On 10/29/12 11:17 AM, Bruce Sherwood wrote:

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.

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

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.

···

On Monday, October 29, 2012 1:29:53 PM UTC-6, Robin Dunn wrote:

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.

In theory the difference would be helpful, but in my case with multiple monitors in play, GetClientSize gives values based on on placement within the set screens - not very useful for me.