Sorry for causing misunderstanding,
I have a panel on my frame, and I do drawings on it (rectangles, shapes
etc) with wxpython GDI (using methods like dc.DrawRectangle etc).
Rectangles and shapes have colors. There are no widgets on the panel.
Just shapes.
When I press a button on the toolbar, I want everything on that panel to
turn into grayscale (all shapes will lose their colors), and a colored
custom progress bar will appear in the middle of that grayscaled panel
(and on top of shapes), and it will run (because a lengthy operation
will be executed). When the execution is completed, the progress bar
will disappear and the shapes on panel will regain its original colors.
I hope I could explain it.
On Monday, September 18, 2017 at 10:43:56 PM UTC+3, Robin Dunn wrote:
wx.Image has a ConvertToGreyscale method.
Drawing in a layer on top of other widgets will be tricky however.
The overlay classes on OSX use a native implementation that can do
that, however the other platforms use a generic overlay based on
ClientDC so it can only support drawing on the window performing the
overlay which is likely to be the parent of the widgets you want to
draw over.
The only approach that comes to mind is to use wx.ScreenDC to blit a
snapshot of the window into a bitmap, temporarily replace (or hide)
the current contents of the window with one that displays that
bitmap and supports drawing like you want. However that won't work
on OSX (DC's are one-way there, in most cases you can't easily get
their current contents) but you can use the overlay classes there.
Also, IIRC the ScreenDC approach may or may not work on Linux,
depending on a number of factors.
Robin
On Monday, September 18, 2017 at 10:43:15 AM UTC-7, Tim Roberts wrote:
steve wrote:
>
> I would like to get a grayscale screenshot (overlay) of the
current
> window and do drawings on it. I mean, the current window and all
> widgets, etc on it should lose all their colors and I should do
> drawings on it. Do you know how to do this?
Well, an overlay is something that appears over the top of an
existing
window, so the controls on the window still show through. Is that
really what you're after? It sounds like you want a separate
window
contains a converted copy of your current window, so the existing
controls are not visible.
There is nothing in wx that will convert a color bitmap to a
grayscale
bitmap, in part because the definition of "grayscale" is not
completely
uniform. You'll have to do that by hand, pixel by pixel, or using
another graphics library. It's not hard.
Perhaps you should describe what you're trying to in a bit more
detail.
--
Tim Roberts, ti...@probo.com <javascript:>
Providenza & Boekelheide, Inc.