Showing a partially-transparent image on the entire screen

Hello folks!

I haven’t been here in a long while! I’ve been developing for the web using Django for a long time, and I’ve neglected my wxPython projects. But now I’m cooking up a little project, and I have a question:

I want to show a partially transparent image over the entire area of the screen, without any window chrome, i.e. no maximize/minimize/close buttons, no title bar, not even any borders. In fact, if the user has multiple monitors, I want to show an image on each and every monitor. And the image should be on top of all the windows and even on top of the task bar.

If you’re wondering what I’m up to: http://superuser.com/questions/452413/virtual-mouse-using-the-keyboard

My question: What would be a good tool to showing these images?

Thanks,

Ram.

I'm thinking wx.ScreenDC -- maybe needing GraphicsContext to support the Alpha.

wx.Display should give you the display info you need to know what size
to draw, etc.

Not sure how you can tell wx.ScreenDC what display you want, though...

Let us know what you find out.

-Chris

···

On Mon, Jul 23, 2012 at 3:00 PM, Ram Rachum <ram.rachum@gmail.com> wrote:

I want to show a partially transparent image over the entire area of the
screen, without any window chrome, i.e. no maximize/minimize/close buttons,
no title bar, not even any borders. In fact, if the user has multiple
monitors, I want to show an image on each and every monitor. And the image
should be on top of all the windows and even on top of the task bar.

--

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

You'll probably need to drop down to native API code to do this really well, but one wx approach to try is to create a wx.ScreenDC and draw on that like any other DC. Potential problems with this are that some platforms may or may not allow wx.ScreenDC to draw to the screen, or that as soon as some other application updates its own display then your drawings will appear to be overdrawn.

···

On 7/23/12 3:00 PM, Ram Rachum wrote:

Hello folks!

I haven't been here in a long while! I've been developing for the web
using Django for a long time, and I've neglected my wxPython projects.
But now I'm cooking up a little project, and I have a question:

I want to show a partially transparent image over the entire area of the
screen, without any window chrome, i.e. no maximize/minimize/close
buttons, no title bar, not even any borders. In fact, if the user has
multiple monitors, I want to show an image on each and every monitor.
And the image should be on top of all the windows and even on top of the
task bar.

If you're wondering what I'm up to:
http://superuser.com/questions/452413/virtual-mouse-using-the-keyboard

My question: What would be a good tool to showing these images?

--
Robin Dunn
Software Craftsman
http://wxPython.org

Thanks for the answers guys.

But, I don’t understand; can’t I just create a window, like Frame with modifiers that make it not draw any chrome (borders, buttons, title), or maybe whatever window wxPython uses for splash images? Why wouldn’t that work?

Thanks,

Ram.

···

On Tue, Jul 24, 2012 at 1:52 AM, Robin Dunn robin@alldunn.com wrote:

On 7/23/12 3:00 PM, Ram Rachum wrote:

Hello folks!

I haven’t been here in a long while! I’ve been developing for the web

using Django for a long time, and I’ve neglected my wxPython projects.

But now I’m cooking up a little project, and I have a question:

I want to show a partially transparent image over the entire area of the

screen, without any window chrome, i.e. no maximize/minimize/close

buttons, no title bar, not even any borders. In fact, if the user has

multiple monitors, I want to show an image on each and every monitor.

And the image should be on top of all the windows and even on top of the

task bar.

If you’re wondering what I’m up to:

http://superuser.com/questions/452413/virtual-mouse-using-the-keyboard

My question: What would be a good tool to showing these images?

You’ll probably need to drop down to native API code to do this really well, but one wx approach to try is to create a wx.ScreenDC and draw on that like any other DC. Potential problems with this are that some platforms may or may not allow wx.ScreenDC to draw to the screen, or that as soon as some other application updates its own display then your drawings will appear to be overdrawn.

Robin Dunn

Software Craftsman

http://wxPython.org

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en

Ram Rachum wrote:

But, I don't understand; can't I just create a window, like Frame with
modifiers that make it not draw any chrome (borders, buttons, title),
or maybe whatever window wxPython uses for splash images? Why wouldn't
that work?

It takes more than that, because those windows are rectangular. Even if
you never draw anything in your window, the operating system believes
you "own" the screen pixels in your rectangular window. None of the
applications that are underneath yours will refresh themselves while
your window is displayed. They don't have to, because your window is
hiding them.

Now, you can add an attribute to make your window transparent. That
applies a single transparency level to the entire window. Your window
is blended into the background. That might possibly do what you want;
you could draw your window with a low alpha value, so the background
shows through strongly, and draw your grid and your letters
white-on-black. The black areas will cause the background to dim
slightly, the white areas would pop out slightly.

···

--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

You could also try setting the shape of the frame, with "holes" in the region which defines the shape where you want the background to show through. This would give you the ability to have the non-holed areas to be fully opaque if you want, instead of requiring the whole frame to be partially transparent. However I expect that as the number of the holes goes up, or in general the more irregular the shape becomes, that the quality of the look and behavior will go down.

···

On 7/23/12 4:40 PM, Tim Roberts wrote:

Ram Rachum wrote:

But, I don't understand; can't I just create a window, like Frame with
modifiers that make it not draw any chrome (borders, buttons, title),
or maybe whatever window wxPython uses for splash images? Why wouldn't
that work?

It takes more than that, because those windows are rectangular. Even if
you never draw anything in your window, the operating system believes
you "own" the screen pixels in your rectangular window. None of the
applications that are underneath yours will refresh themselves while
your window is displayed. They don't have to, because your window is
hiding them.

Now, you can add an attribute to make your window transparent. That
applies a single transparency level to the entire window. Your window
is blended into the background. That might possibly do what you want;
you could draw your window with a low alpha value, so the background
shows through strongly, and draw your grid and your letters
white-on-black. The black areas will cause the background to dim
slightly, the white areas would pop out slightly.

--
Robin Dunn
Software Craftsman
http://wxPython.org

Thanks for your help everybody!

So far I’m using simple frames and it seems to be successful. There are a few glitches so I’m not 100% sure that this approach will work, but I’ll keep trying it.

Thanks!

Ram.

···

On Tue, Jul 24, 2012 at 8:11 PM, Robin Dunn robin@alldunn.com wrote:

On 7/23/12 4:40 PM, Tim Roberts wrote:

Ram Rachum wrote:

But, I don’t understand; can’t I just create a window, like Frame with

modifiers that make it not draw any chrome (borders, buttons, title),

or maybe whatever window wxPython uses for splash images? Why wouldn’t

that work?

It takes more than that, because those windows are rectangular. Even if

you never draw anything in your window, the operating system believes

you “own” the screen pixels in your rectangular window. None of the

applications that are underneath yours will refresh themselves while

your window is displayed. They don’t have to, because your window is

hiding them.

Now, you can add an attribute to make your window transparent. That

applies a single transparency level to the entire window. Your window

is blended into the background. That might possibly do what you want;

you could draw your window with a low alpha value, so the background

shows through strongly, and draw your grid and your letters

white-on-black. The black areas will cause the background to dim

slightly, the white areas would pop out slightly.

You could also try setting the shape of the frame, with “holes” in the region which defines the shape where you want the background to show through. This would give you the ability to have the non-holed areas to be fully opaque if you want, instead of requiring the whole frame to be partially transparent. However I expect that as the number of the holes goes up, or in general the more irregular the shape becomes, that the quality of the look and behavior will go down.

Robin Dunn

Software Craftsman

http://wxPython.org

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en