0

In the course of buying a new laptop, I've upgraded wxPython to version 4.2.2, and in an otherwise-fine GUI application (including tree, forms, perspectives, ... all provided with wxPython), the placement of StaticBitmap controls on a Panel does not work anymore:

Instead of being laid out in a grid, the bitmaps all start from the origin (0,0), overlapping. The correct position is supplied to StaticBitmap() (as before with the old wxPython version), but seemingly the behavior of StaticBitmap or Panel or ... has changed.

In the documentation, there's the caveat that StaticBitmap is reliable only for small images, and larger images should use GenericStaticBitmap. Is that the point of change and failure?

Any pointers?

EDIT: Forgot to mention: I also checked the wxPython version history and only found "added wrapper to GenericStaticBitmap" (v4.2.1) while searching for "StaticBitmap" - this should not affect the use of StaticBitmap, I think.

1
  • I believe you will have to provide an MWE and/or much more information. Are the bitmaps laid out with a sizer? What platform and OS? Commented Mar 7 at 21:09

1 Answer 1

1

As every so often, a trivial mistake: The position parameters for the origin were not converted to int, but were floating point values. I can't believe the old laptop had a resolution which never resulted in .5 floats, but applying int(...) solves the issue.

Switching to wx.GenericStaticBitmap didn't help, by the way.

Sign up to request clarification or add additional context in comments.

3 Comments

Plus 1 for having the cajones to admit the error. The point being that even the error will almost certainly help someone else who has a similar error and didn't check.
:-) Thanks, that was my thinking as well.
Probably has nothing to do with the laptops resolution. I remember "suddenly" getting such errors on the same exact hardware as before (the screen, the GPU, everything). Worked before with whatever numerals, I didn't bother explicitly converting to int, because why would I, then I upgraded wxPython and it didn't work anymore. Although, as I remember, I got runtime exceptions, not the program "working" but misbehaving.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.