Toolbar button alpha channel problem in matplotlib

7 views
Skip to first unread message

Werner F. Bruhin

unread,
Jun 9, 2005, 5:01:18 AM6/9/05
to wxPytho...@lists.wxwidgets.org
The matplotlib 0.81 version disables buttons on the toolbar which are
not usable at the time.

Doing this shows a black square instead of applying the alpha channel
(correct terminology?).

To ensure that the icon file actually is o.k. I created a toolbar with
the icon in question and it shows correctly as a black and white version
when it is in-active and a colored version when it is active.

Matplotlib uses "AddSimpleTool" to create the tools, so I tried
"AddLabelTool" and "DoAddTool". With the later two calls the image is
now in color if active or in-active - still not showing the black and
white version.

Here some code snippets:
self.AddLabelTool(label = 'Back',
bitmap = _load_bitmap2('back.png'),
bmpDisabled = wx.NullBitmap,
id = self._NTB2_BACK,
longHelp = '',
shortHelp = '')

_load_bitmap2 is just checking that the image exists and returns a
wx.Bitmap instance.

The attached "toolbartest.png" shows what we like to see and the
"matplottoolbar.png" shows the back button in color using the
"AddLabelTool" and the grey square is for the forward button which uses
"AddSimpleTool".

Any hints on how to fix this would be very welcome.

See you
Werner


matplottoolbar.png
toolbartest.png

Robin Dunn

unread,
Jun 9, 2005, 2:05:35 PM6/9/05
to wxPytho...@lists.wxwidgets.org
Werner F. Bruhin wrote:

> The attached "toolbartest.png" shows what we like to see and the
> "matplottoolbar.png" shows the back button in color using the
> "AddLabelTool" and the grey square is for the forward button which uses
> "AddSimpleTool".
>
> Any hints on how to fix this would be very welcome.

Both AddSimpleTool and AddLabelTool call DoAddTool, so there must be
some other difference between the two cases. What is the platform and
version? Can you send a small sample (including the images) that shows
the problem?

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


Werner F. Bruhin

unread,
Jun 10, 2005, 10:29:46 AM6/10/05
to wxPytho...@lists.wxwidgets.org
Hi Robin,

The mystery of the color or grey square button is me forgetting what I
am doing!

The grey square is the due to matplotlib using "xpm" file format and
wxPython only supports alpha channel with "png" file format, according
to the documentation.

However I still can't figure out why the color version is shown (when
using "png" files) when the tool button is disabled, it should show the
grey & white version.

Had no success in creating a small test program showing the problem,
will have another go at it next week.

See you
Werner


Werner F. Bruhin wrote:

> Hi Robin,


>
> Robin Dunn wrote:
>
>> Werner F. Bruhin wrote:
>>
>>> The attached "toolbartest.png" shows what we like to see and the
>>> "matplottoolbar.png" shows the back button in color using the
>>> "AddLabelTool" and the grey square is for the forward button which
>>> uses "AddSimpleTool".
>>>
>>> Any hints on how to fix this would be very welcome.
>>
>>
>>
>> Both AddSimpleTool and AddLabelTool call DoAddTool, so there must be
>> some other difference between the two cases. What is the platform
>> and version? Can you send a small sample (including the images) that
>> shows the problem?
>
>
>

> I am running on Windows XP but I believe Andrea is seeing the same and
> if I recall correctly she is on Windows XP.
>
> Small sample with matplotlib (you would need to get the 0.8.1
> version)?! I only see the problem in matplotlib with the WXAgg, I
> can't reproduce it in a small test program (at least not yet).
>
> Just in case you have matplotlib try running wxcursor_demo (I attach
> it in case you don't have the matplotlib example stuff).
>
> See you
> Werner
>
>
>------------------------------------------------------------------------
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: wxPython-user...@lists.wxwidgets.org
>For additional commands, e-mail: wxPython-...@lists.wxwidgets.org
>

Werner F. Bruhin

unread,
Jun 10, 2005, 3:37:55 AM6/10/05
to wxPytho...@lists.wxwidgets.org
Hi Robin,

Robin Dunn wrote:

> Werner F. Bruhin wrote:
>
>> The attached "toolbartest.png" shows what we like to see and the
>> "matplottoolbar.png" shows the back button in color using the
>> "AddLabelTool" and the grey square is for the forward button which
>> uses "AddSimpleTool".
>>
>> Any hints on how to fix this would be very welcome.
>
>
> Both AddSimpleTool and AddLabelTool call DoAddTool, so there must be
> some other difference between the two cases. What is the platform and
> version? Can you send a small sample (including the images) that
> shows the problem?

wxcursor_demo.py

Peter Damoc

unread,
Jun 10, 2005, 4:09:03 AM6/10/05
to wxPytho...@lists.wxwidgets.org
On Fri, 10 Jun 2005 10:37:55 +0300, Werner F. Bruhin
<werner...@free.fr> wrote:

> Hi Robin,
>
> Robin Dunn wrote:
>
>> Werner F. Bruhin wrote:
>>
>>> The attached "toolbartest.png" shows what we like to see and the
>>> "matplottoolbar.png" shows the back button in color using the
>>> "AddLabelTool" and the grey square is for the forward button which
>>> uses "AddSimpleTool".
>>>
>>> Any hints on how to fix this would be very welcome.
>>
>>
>> Both AddSimpleTool and AddLabelTool call DoAddTool, so there must be
>> some other difference between the two cases. What is the platform and
>> version? Can you send a small sample (including the images) that
>> shows the problem?
>
>
> I am running on Windows XP but I believe Andrea is seeing the same and
> if I recall correctly she is on Windows XP.

dude :) she is a he :)
http://xoomer.virgilio.it/infinity77/
In Italy Andrea is a boy name ;)
honest mistake tho :) my future wife's name is Andreea. :)

Peter


andrea...@tin.it

unread,
Jun 10, 2005, 4:57:12 AM6/10/05
to wxPytho...@lists.wxwidgets.org
>> I am running on Windows XP but I believe Andrea is seeing the same and
>> if I recall correctly she is on Windows XP.
>
>dude :) she is a he :)
>http://xoomer.virgilio.it/infinity77/
>In Italy Andrea is a boy name ;)
>honest mistake tho :) my future wife's name is Andreea. :)

Hehehehehehe... it is normal, everywhere I go people keep saying "from your
name I was expecting a woman..."
No rpoblem for that ;-)
However, when I posted my first controls (like FoldPanelBar, HyperLinkCtrl,
ExtendedChoice and so on), I was somehow impressed by the number of nice
replies/comments I got. Did the "he/she" confusion influenced your suggestions/comments?
;-)))))

Andrea.


Franz Steinhäusler

unread,
Jun 10, 2005, 5:08:11 AM6/10/05
to wxpytho...@lists.wxwindows.org

Hello Andrea,

in your first posts, I wasn't really sure.
You could be a "she" or "he", but that should make no difference.

At the same time I remembered a former Formula One driver
"Andrea de Cesaris".

In german "Andrea" is a woman forename (not sure, how it is in english)
in oppostition to Andreas.
But more often, woman forenames are longer than the man counterparts.

man -> woman

Franz -> Franziska
Martin -> Martina
Stefan -> Stefanie
Daniel -> Daniela

--
Franz Steinhaeusler


Werner F. Bruhin

unread,
Jun 10, 2005, 6:19:03 AM6/10/05
to wxPytho...@lists.wxwidgets.org
Hi Andrea,

andrea...@tin.it wrote:

Absolutely :-D

Being Swiss I should not have missed that one :-[ , hope you'll forgive me!

Coming back to this toolbar issue, created a small test program to try
to imitate the stuff matplotlib does with the toolbar but on my system
(XP) it works like a charm, but within matplotlib I still get this damn
grey squares.

It is obviously way above my head!

See you
Werner

>Andrea.

Peter Damoc

unread,
Jun 10, 2005, 9:35:14 AM6/10/05
to wxPytho...@lists.wxwidgets.org
On Fri, 10 Jun 2005 16:23:18 +0300, the_shelter <pdf...@the-shelter.de>
wrote:

> Just to make the she/he subject complete:
> Andrea stems from greek meaning 'man' ...
> Being a German myself, I wonder what language got confused ;)
> But seriously,
> with me affection only has me for the nice controls you have posted.
> Keep hanging in there! I really like them a lot!
>

well to make the subject complete you should have posted
this:
http://behindthename.com/nm/a3.html
or this...
http://behindthename.com/php/view.php?name=andrea-1

now let's face it... we all like Andrea for the widgets he brought to
wxPython... but... it wouldn't have hurt to look a little bit like this:
http://devone.de/pics/linux_chick.jpg

:)

Peter.

the_shelter

unread,
Jun 10, 2005, 9:23:18 AM6/10/05
to Franz Steinhäusler
Just to make the she/he subject complete:
Andrea stems from greek meaning 'man' ...
Being a German myself, I wonder what language got confused ;)
But seriously,
with me affection only has me for the nice controls you have posted.
Keep hanging in there! I really like them a lot!

--
Best regards,
the_shelter mailto:pdf...@the-shelter.de


andrea...@tin.it

unread,
Jun 10, 2005, 12:14:21 PM6/10/05
to wxPytho...@lists.wxwidgets.org
>now let's face it... we all like Andrea for the widgets he brought to

>wxPython... but... it wouldn't have hurt to look a little bit like this:
>http://devone.de/pics/linux_chick.jpg

Wow... what a nice programmer this chick ;-)
No luck for me, I have never met a Linux/Windows/Unix/Mac/Debian/Whatever
programmer like that... mhm, do I have to switch to another GUI tool to
find her? ;-)

Andrea.


Robin Dunn

unread,
Jun 10, 2005, 2:07:41 PM6/10/05
to wxPytho...@lists.wxwidgets.org
Werner F. Bruhin wrote:
> Hi Robin,
>
> The mystery of the color or grey square button is me forgetting what I
> am doing!
>
> The grey square is the due to matplotlib using "xpm" file format and
> wxPython only supports alpha channel with "png" file format, according
> to the documentation.

XPM files do support a mask, or in other words a 1-bit alpha where each
pixel is either fully transparent or fully opaque, (so there is no
blending.)

>
> However I still can't figure out why the color version is shown (when
> using "png" files) when the tool button is disabled, it should show the
> grey & white version.

That I don't know...

Franz Steinhäusler

unread,
Jun 11, 2005, 3:46:34 PM6/11/05
to wxpytho...@lists.wxwindows.org
On Fri, 10 Jun 2005 16:35:14 +0300, "Peter Damoc" <pda...@gmx.net> wrote:

>On Fri, 10 Jun 2005 16:23:18 +0300, the_shelter <pdf...@the-shelter.de>
>wrote:
>
>> Just to make the she/he subject complete:
>> Andrea stems from greek meaning 'man' ...
>> Being a German myself, I wonder what language got confused ;)
>> But seriously,
>> with me affection only has me for the nice controls you have posted.
>> Keep hanging in there! I really like them a lot!
>>
>
>well to make the subject complete you should have posted
>this:
>http://behindthename.com/nm/a3.html
>or this...
>http://behindthename.com/php/view.php?name=andrea-1
>
>

>Peter.

Hello Peter,

thank you for this interesting site.

For me applies:

"
German form of Franciscus (see FRANCIS). This name was borne by the influential author Franz Kafka, writer of 'The Trial' and 'The
Castle' among other works.

Also, rulers of Austria and the Holy Roman Empire have had this name.
"

Wow, what honour ;)

--
Franz Steinhäusler

DrPython (Project Developer)
http://mitglied.lycos.de/drpython/


Reply all
Reply to author
Forward
0 new messages