[wxPython-users] A couple of bugs?
Robin Dunn
robin at alldunn.com
Tue Apr 3 11:00:39 PDT 2007
Andrea Gavana wrote:
> Hi All,
>
> I am trying to use wx.StaticBox in a less "ordinary" way, and I
> hit a small wall in doing a couple of things.
>
> 1) Is it normal that calling
> wx.StaticBox.GetClassDefaultAttributes().colFg crashes Python with the
> classical error dialog?
There is a problem with Python trying to use the color value after the
visual attributes object has been destroyed, and SWIG is using a pointer
to the colFg value instead of treating it as immutable and making a
copy. I'll see if I can trick it into making a copy instead. In the
meantime you can work around this by doing
attr = wx.StaticBox.GetClassDefaultAttributes()
colFg = wx.Colour(*attr.colFg)
>
> 2) I wanted to change the label colour for the staticbox, and I
> noticed that it works quite well except for one thing. If you look at
> the following picture:
>
> http://xoomer.alice.it/infinity77/wxpython_staticbox.png
>
> You will see that the first staticbox label has its native colour and
> the staticbox rounded rectangle is perfectly visible also very close
> to the text. But for the second staticbox (for which I changed the
> label colour to red), it looks like the label is covering part of the
> rectangle (it is highlighted with a blue rectangle).
This (or something like it) was discussed on wx-dev a while back. I
think a fix has been made already, but it may have only been done in the
2.9 source tree.
>
> Also, is there a way to restore the original (native) colour for the
> text in the staticbox?
Setting the foreground colour to wx.NullColour should do it.
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
More information about the wxpython-users
mailing list