Failed to shape window on my own

I want to set a non-rectangular shape for the window, but it always fails.
My code and picture is in accessory.
Please help~

test.py (1.42 KB)

test.png

The png you sent DOES show a non-rectangular window ?

Karsten

···

On Sun, Apr 07, 2013 at 04:27:27PM +0800, daedae11 wrote:

I want to set a non-rectangular shape for the window, but it always fails.

--
GPG key ID E4071346 @ gpg-keyserver.de
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346

I got the png from photoshop, the part out of the shape is transparent. If this png file doesn’t meet requirement, which kind of png files should I use and How can I get them?
Thanks~


<details class='elided'>
<summary title='Show trimmed content'>&#183;&#183;&#183;</summary>

At 2013-04-07 16:35:31,"Karsten Hilbert" <Karsten.Hilbert@gmx.net> wrote:
>On Sun, Apr 07, 2013 at 04:27:27PM +0800, daedae11 wrote:
>
>> I want to set a non-rectangular shape for the window, but it always fails.
>
>The png you sent DOES show a non-rectangular window ?
>
>Karsten
>-- 
>GPG key ID E4071346 @ gpg-keyserver.de
>E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346
>
>-- 
>You received this message because you are subscribed to the Google Groups "wxPython-users" group.
>To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.
>For more options, visit https://groups.google.com/groups/opt_out.
>
>

daedae11 wrote:

I want to set a non-rectangular shape for the window, but it always fails.
My code and picture is in accessory.
Please help~

wx.RegionFromBitmap uses the bitmap's mask to determine the shape of the region, however your image does not have a mask, it has an alpha-channel instead. There are a couple ways to get a mask for your image programatically (wx.Bitmap.SetMaskColour, wx.Image.ConvertAlphaToMask) or you can modify the source image so it has a mask (aka 1-bit alpha instead of 8-bit, every pixel either fully opaque or fully transparent) or just use an image format that doesn't support alpha.

···

--
Robin Dunn
Software Craftsman