New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wx.StaticBox positioning issue #974

Closed
blitzmann opened this Issue Aug 25, 2018 · 6 comments

Comments

Projects
None yet
3 participants
@blitzmann
Copy link

blitzmann commented Aug 25, 2018

Operating system: Windows 10
wxPython version & source: 4.0.3 stock
Python version & source: 3.6 stock

Description of the problem:
Using a wx.StaticBox, as laid out in the demo, causes positioning issues wherein the children overlap the title of the box

image

See the demo for example

@blitzmann

This comment has been minimized.

Copy link

blitzmann commented Aug 25, 2018

Using the inspector, it seems that the sizer insider the static box actually takes up the same space.

image

A work around for this would be to adjust the border amount in this line on the demo:

bsizer1.Add(t1, 1, wx.EXPAND|wx.TOP|wx.LEFT|wx.RIGHT, 10)

to add the bottom but also a bit more to the top.

Now the question is, is this intended? Seems a bit strange.

@blitzmann

This comment has been minimized.

Copy link

blitzmann commented Aug 25, 2018

Seems this might be a windows-only bug. After implementing a work around similar to the above mentioned, one of our linux devs posted a screenshot of the linux gui looking jacked while Windows UI looks fine. :/

@Metallicow

This comment has been minimized.

Copy link
Contributor

Metallicow commented Aug 26, 2018

Ya I notice it on windows. Didn't realize it was specific, but ya when I do a full test on linux usually one will look wrong cause I compensate for the top edge by a few pixels.

@blitzmann

This comment has been minimized.

Copy link

blitzmann commented Aug 30, 2018

The only solve I have for it right now is to check if it's a windows machine and do adjustments. Pretty hacky. @RobinD42 is there a better solution?

@RobinD42

This comment has been minimized.

Copy link
Member

RobinD42 commented Aug 30, 2018

Yep, there is a better way. The wx.StaticBoxSizer uses an undocumented function to get a platform-specific amount of border space for the top and the sides. When adding items as children of the static box and using a regular sizer we lose that bit of smarts for the layout.

I've exposed that function in the linked PR and updated the demo to use it.

@RobinD42

This comment has been minimized.

Copy link
Member

RobinD42 commented Aug 30, 2018

Fixed by #980

@RobinD42 RobinD42 closed this Aug 30, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment