I'm creating a CollapsiblePane with a custom button. A plain
wx.CollapsiblePane won't do that, so I'm using a
wx.lib.agw.pycollapsiblepane.PyCollapsiblePane.
I need each state (expanded, collapsed) to have a different bitmap for
the pane's button (whether by changing the button's bitmap or changing
the button altogether). I've tried subclassing PyCollapsiblePane and
overriding both OnStateChange and OnButton with code to change the
button, but neither has worked for me. Any ideas?
Please make a small runnable sample that shows one of the cases that you think should be working that is not. MakingSampleApps - wxPyWiki
···
On 6/20/11 2:00 PM, Rafe Kettler wrote:
I'm creating a CollapsiblePane with a custom button. A plain
wx.CollapsiblePane won't do that, so I'm using a
wx.lib.agw.pycollapsiblepane.PyCollapsiblePane.
I need each state (expanded, collapsed) to have a different bitmap for
the pane's button (whether by changing the button's bitmap or changing
the button altogether). I've tried subclassing PyCollapsiblePane and
overriding both OnStateChange and OnButton with code to change the
button, but neither has worked for me. Any ideas?
I should probably also mention that I've had a project in the past where I overrode OnStateChange in a derived class in order to change the button's bitmap and some other things, so it is possible. I also changed the type of button in that project but I don't recall at the moment if I needed to do that for changing the bitmap or if I just wanted a different look. Much of the changes I needed in order to do that have been merged back into the PyCollapsiblePane class.
···
On 6/20/11 2:52 PM, Robin Dunn wrote:
On 6/20/11 2:00 PM, Rafe Kettler wrote:
I'm creating a CollapsiblePane with a custom button. A plain
wx.CollapsiblePane won't do that, so I'm using a
wx.lib.agw.pycollapsiblepane.PyCollapsiblePane.
I need each state (expanded, collapsed) to have a different bitmap for
the pane's button (whether by changing the button's bitmap or changing
the button altogether). I've tried subclassing PyCollapsiblePane and
overriding both OnStateChange and OnButton with code to change the
button, but neither has worked for me. Any ideas?
Please make a small runnable sample that shows one of the cases that you
think should be working that is not. MakingSampleApps - wxPyWiki
This was quite excellent advice. I worked this out on my own in the
process of making the sample! All I did was override OnButton and call
the BitmapButton's SetBitmapLabel method to change the bitmap
displayed.