[wxPython-users] adding control captions on gradient buttonpanel
C M
cmpython at gmail.com
Tue Dec 18 16:10:12 PST 2007
On Dec 18, 2007 4:19 PM, Andrea Gavana <andrea.gavana at gmail.com> wrote:
> Hi,
>
> On Dec 18, 2007 8:14 AM, C M wrote:
> > I'd like to try to use a ButtonPanel with a gradient to hold some
> controls,
> > but I also would like to have static text near the controls to indicate
> > their function or caption them. But if I just add a wxStaticTextCtrl to
> the
> > ButtonPanel, the background color of the statictext is used and of
> course it
> > doesn't look quite right on the gradient (you can see the edges of the
> > rectangle).
> >
> > But with ButtonPanel, there is a main caption text, as well as button
> > captions, and both of these are done in such a way as they do not
> produce
> > this problem--they just sit nicely over the gradient. I don't
> understand
> > how this is done because I don't yet understand how DC and drawing
> works.
> >
> > I was wondering if there is or could be a way to allow placement of text
> on
> > a gradient ButtonPanel so that it looks good with the gradient? (the
> > positioning itself may require sizers, but one thing at a time). And
> can
> > font and font size also be specified?
>
> The only way I can see it right now is to hack the ButtonPanel source
> code... the problem is, whatever you do with a wx.StaticText, it does
> not let the underlying "theme" (or gradient) shine through it, it uses
> its own background colour or the one inherited by its parent (if it is
> a solid one). Have you tried doing something like:
>
> yourStaticText.Bind(wx.EVT_ERASE_BACKGROUND, self.OnErase)
>
> def OnErase(self, event):
>
> pass
>
> ? I don't know if this will change anything.
Yup, didn't work.
If it doesn't, then you might consider hacking the wx.lib.stattext code to
> try to let the
> gradient shine through. It would be an easy task to solve if someone
> could answer to this question:
>
> Is there a way to ask a wx.lib.stattext *not* to paint its rectangular
> background but let the underground colour (parent
> colour/theme/gradient) shine through?
>
I'll hope for that answer. In the meantime, do you happen to understand how
the main caption is done such that this doesn't have this problem? Because
I thought maybe I could try that approach?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wxpython-users/attachments/200712=
18/a6c1f3f8/attachment.htm
More information about the wxpython-users
mailing list