[wxPython-users] Scrolling text overlay
Robin Dunn
robin at alldunn.com
Tue Apr 3 11:00:00 PDT 2007
Mike Rooney wrote:
> Hi everyone,
>
> I am wondering if I can use wxPython to display a scrolling text
> "banner" across a certain part of the screen. I don't think coding the
> scrolling would be the problem; my main issue is getting text with a
> transparent background "overlayed" on top of the users screen. I see
> that you can do transparent/shaped splash windows so I was wondering if
> I can use this somehow.
>
> Another alternative I suppose could be using PIL to generate images of
> the text with transparent backgrounds but that seems like it could be slow.
>
> Has anyone done anything similar to this and could lead me to an
> example, or suggestions? This will only be used on MSW, by the way.
Shaped windows basically work by setting a region of the frame that
should be transparent, and one way to get the region is from the mask of
a bitmap. So you can create a memory DC, fill it with a certain color,
draw your text to the bitmap, destroy the dc and then set the bitmap's
mask to be the fill color. Then you can set the frame's shape from the
mask/region of the bitmap and then draw that bitmap in the frame's
EVT_PAINT handler. When you want to scroll the text you'll need to do
the whole thing again.
Another approach would be to simply create a wx.ScreenDC and draw the
text on it, which will result in the drawing taking place directly on
the screen's pixel buffer. This is much simpler, but since it is not a
separate window the drawing can get overwritten by other apps refreshing
their windows, etc.
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
More information about the wxpython-users
mailing list