Transparent windows inwxPython

Is it possible to create a transparent window (or image in a window) that can be overlaid on top of existing desktop windows so that the existing windows can still be seen and so that keyboard and mouse events still go to the underlying window?

A sort of software mylar sheet.

TIA.

Is it possible to create a transparent window (or image in a window)
that can be overlaid on top of existing desktop windows so that the
existing windows can still be seen and so that keyboard and mouse events
still go to the underlying window?

Top level windows have a method called SetTransparent, it takes a
value from 0 (opaque) to 255 (invisible?)

···

2007/10/6, Don Taylor <nospamformeSVP@gmail.com>:

A sort of software mylar sheet.

TIA.

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

--
-- Guilherme H. Polo Goncalves

Guilherme Polo wrote:

Top level windows have a method called SetTransparent, it takes a
value from 0 (opaque) to 255 (invisible?)

Ok, that sounds good for the transparency part and I have found the relevant example in the wiki which is great!

http://wiki.wxpython.org/Transparent_Frames?highlight=(transparent)

But what about window focus? If I have a transparent window covering a normal window from a _different_ application and I click on the common area then:

Which window gets the focus?

Can I type into the underlying window as if the transparent window was not there?

Thx.

Don.

Guilherme Polo wrote:

> Top level windows have a method called SetTransparent, it takes a
> value from 0 (opaque) to 255 (invisible?)

Ok, that sounds good for the transparency part and I have found the
relevant example in the wiki which is great!

http://wiki.wxpython.org/Transparent_Frames?highlight=(transparent)

But what about window focus? If I have a transparent window covering a
normal window from a _different_ application and I click on the common
area then:

Which window gets the focus?

The one that is in front

Can I type into the underlying window as if the transparent window was
not there?

If you have a window that is transparent and other that isn't when you
focus the one that is fully opaque it will cover the transparent one.

···

2007/10/6, Don Taylor <nospamformeSVP@gmail.com>:

Thx.

Don.

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

--
-- Guilherme H. Polo Goncalves

Guilherme Polo wrote:

If you have a window that is transparent and other that isn't when you
focus the one that is fully opaque it will cover the transparent one.

That is too bad as this is not the behaviour I need. I really want a transparent overlay that behaves as if was just a transparent mylar sheet stuck on the surface monitor that I can type through.

May be DirectPython can do it.

Thx.

Don.

Guilherme Polo wrote:

>
> If you have a window that is transparent and other that isn't when you
> focus the one that is fully opaque it will cover the transparent one.
>
That is too bad as this is not the behaviour I need. I really want a
transparent overlay that behaves as if was just a transparent mylar
sheet stuck on the surface monitor that I can type through.

I believe that depends totally on the window manager, you could try
keeping your semi-transparent window always on top and calling the
other window to check what you get.

···

2007/10/6, Don Taylor <nospamformeSVP@gmail.com>:

May be DirectPython can do it.

Thx.

Don.

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

--
-- Guilherme H. Polo Goncalves

You're going to have to go platform-native for this, and the "full
screen invisible window" approach probably isn't going to be what you
want for anything. You generally do this by installing a system-wide
mouse hook and looking for hits in specific locations.

Can you explain your use case in some more detail? We might be able to
offer some better suggestions if you say what you're trying to do.

···

On 10/6/07, Guilherme Polo <ggpolo@gmail.com> wrote:

2007/10/6, Don Taylor <nospamformeSVP@gmail.com>:
> Guilherme Polo wrote:
>
> >
> > If you have a window that is transparent and other that isn't when you
> > focus the one that is fully opaque it will cover the transparent one.
> >
> That is too bad as this is not the behaviour I need. I really want a
> transparent overlay that behaves as if was just a transparent mylar
> sheet stuck on the surface monitor that I can type through.
>

I believe that depends totally on the window manager, you could try
keeping your semi-transparent window always on top and calling the
other window to check what you get.

> May be DirectPython can do it.
>

Don Taylor wrote:

Guilherme Polo wrote:

Top level windows have a method called SetTransparent, it takes a
value from 0 (opaque) to 255 (invisible?)

Ok, that sounds good for the transparency part and I have found the relevant example in the wiki which is great!

http://wiki.wxpython.org/Transparent_Frames?highlight=(transparent)

But what about window focus? If I have a transparent window covering a normal window from a _different_ application and I click on the common area then:

Which window gets the focus?

Can I type into the underlying window as if the transparent window was not there?

No, the transparency only affects painting, not event propagation. In that respect it will behave exactly the same way as if it were fully opaque.

However you might try giving the transparent window the FLOAT_ON_PARENT style and then Raise() the parent window and see if it will then get the keyboard focus like you want. Mouse events will still be a problem however.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Chris Mellon wrote:

Can you explain your use case in some more detail? We might be able to
offer some better suggestions if you say what you're trying to do.

It would be a sort of 'heads-up' display for a variety of assistive applications.

For example, you could have a scribble application that overlays any existing application and allows it to be annotated just as if you picked up a pen and drew on the surface of the screen.

You could write tutorials for existing applications that sit on top of the real application and guide the user through the underlying application.

Another idea would be to throw up a virtual keyboard display on the screen so that folks learning to type could learn while working and not look down at the physical keyboard.

Don.

That's a really interesting idea. wx doesn't have abstractions for any
of the (sometimes quite hairy) OS abstractions you need to do a good
on screen display, though. You'll have to look for native solutions,
I'm afraid.

The annotation in particular is really interesting but likely to be
quite challenging, even with very detailed knowledge of the platform
APIs. The compiz window manager for *nix has a plugin that implements
something very much like it, but I don't know that either Windows or
OS X has the infrastructure support you'd need.

···

On 10/10/07, Don Taylor <nospamformeSVP@gmail.com> wrote:

Chris Mellon wrote:

> Can you explain your use case in some more detail? We might be able to
> offer some better suggestions if you say what you're trying to do.

It would be a sort of 'heads-up' display for a variety of assistive
applications.

For example, you could have a scribble application that overlays any
existing application and allows it to be annotated just as if you picked
up a pen and drew on the surface of the screen.

You could write tutorials for existing applications that sit on top of
the real application and guide the user through the underlying application.

Another idea would be to throw up a virtual keyboard display on the
screen so that folks learning to type could learn while working and not
look down at the physical keyboard.

Don.

Chris Mellon wrote:

···

On 10/10/07, Don Taylor <nospamformeSVP@gmail.com> wrote:

Chris Mellon wrote:

Can you explain your use case in some more detail? We might be able to
offer some better suggestions if you say what you're trying to do.

It would be a sort of 'heads-up' display for a variety of assistive
applications.

For example, you could have a scribble application that overlays any
existing application and allows it to be annotated just as if you picked
up a pen and drew on the surface of the screen.

You could write tutorials for existing applications that sit on top of
the real application and guide the user through the underlying application.

Another idea would be to throw up a virtual keyboard display on the
screen so that folks learning to type could learn while working and not
look down at the physical keyboard.

Don.

That's a really interesting idea. wx doesn't have abstractions for any
of the (sometimes quite hairy) OS abstractions you need to do a good
on screen display, though. You'll have to look for native solutions,
I'm afraid.

The annotation in particular is really interesting but likely to be
quite challenging, even with very detailed knowledge of the platform
APIs. The compiz window manager for *nix has a plugin that implements
something very much like it, but I don't know that either Windows or
OS X has the infrastructure support you'd need.

Sounds a bit like these tools:

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Robin Dunn wrote:

Sounds a bit like these tools:

http://jingproject.com/
FlySketch by Flying Meat

Thanks Robin, what I have in mind is somewhat like flysketch - as far as I can tell by reading the web-site. Both flysketch and jing use the technology I am looking for, but the applications are a little different.

I found this at http://www.codeproject.com/wtl/transparent.asp:

"To create a visible-through (layered) window, we need to set the extended style WS_EX_LAYERED, and to make the window clicked-through, we need the WS_EX_TRANSPARENT extended style. This is done with the SetWindowLong() API function or the ModifyStyleEx() function of the CWindow class. Then, we can use the SetLayeredWindowAttributes() API function to set the opacity and transparency of a layered window. To reverse the transparency, remove the WS_EX_LAYERED and WS_EX_TRANSPARENT styles."

There is also this article about doing the same thing in VB (spit!):

http://articles.techrepublic.com.com/5100-22-5031805.html

Does this do (most of) what I want for MSWin, or am I way off-base here?

Neither of the articles mention passing keyboard events through to the underlying window, although they do describe passing mouse events.

Don.