wx.lib.agw.buttonpanel: how to set disabled images on buttons

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

wx.lib.agw.buttonpanel: how to set disabled images on buttons

TSUBOTA Masami
Hi wxPythoners,

I'm on a Windows 7 machine with python 2.7.8 (32 bit)/wxPython 3.0.2.0.

I have a wx.lib.agw.buttonpanel widget for immitating NavigationToolbar2.
There are several buttons on the buttonpanel.

The problem is that images on buttons don't change for disabled state.
How can I change it?

The following is a class for NavigationToolbar2-like-toolbar.
--------------
import wx.lib.agw.buttonpanel as BP

class MyToolbar(BP.ButtonPanel):
    def __init__(self, parent):
        BP.ButtonPanel.__init__(self, parent)

        self.nb = parent

        self.ID_FIT = wx.NewId()
        self.ID_ZOOM = wx.NewId()

        self.btn_home = BP.ButtonInfo(self, self.ID_FIT,
wx.Image("home.png", wx.BITMAP_TYPE_ANY).ConvertToBitmap())
        self.AddButton(self.btn_home)
        self.btn_zoom = BP.ButtonInfo(self, self.ID_ZOOM,
wx.Image("zoom.png", wx.BITMAP_TYPE_ANY).ConvertToBitmap())
        self.AddButton(self.btn_zoom)

        self.DoLayout()
--------------

The above class is called as:
    self.mtb = MyToolbar(self)

Then, I disabled the btn_home button as follows.
    self.mtb.btn_home.Enabled(False)

It gets disabled but its image on button is not to be grayed-out.
The image is completely same as that of "Normal" state.


Any comments could be helpful. Thank you in advance.

Best wishes,
Masa

--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.