[wxPython-users] Capturing a mouse click on the tab of an already selected notebook page

Andrea Gavana andrea.gavana at gmail.com
Tue Sep 25 01:01:15 PDT 2007


Hi Bob,

On 9/25/07, Bob Klahn wrote:
> How do I do that?  It's probably very simple, but the solution
> continues to escape me.  I suspect I'll slap my forehead when you all
> clue me in ...
>
> I have a splitter with two notebooks, one notebook on each side of the sash.
>
> For =one= type of right-notebook page (not for other right-notebook
> page types), the code that responds to a click there should perform
> its particular task =and= set the focus to a panel on the
> corresponding left-notebook page.
>
> I have no trouble making this happen in response to a click anywhere
> =within= the right-notebook page.  THE PROBLEM occurs when  the =tab=
> of the right-notebook page is clicked.
>
> MY QUESTION:  How do I capture a click on the =tab= of an already
> selected notebook page?
>
> (wx.EVT_NOTEBOOK_PAGE_CHANGED (or wx.EVT_NOTEBOOK_PAGE_CHANGING)
> events are of course not triggered.)

I haven't tried it so I am not sure it will work, but what about something like:

yourNotebook.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)

def OnLeftDown(self, event):

    # Do something to the other notebook
    event.Skip()

When the 2 notebook events (wx.EVT_NOTEBOOK_PAGE_CHANGED or
wx.EVT_NOTEBOOK_PAGE_CHANGING) are not triggered, probably the
wx.EVT_LEFT_DOWN is sent.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/




More information about the wxpython-users mailing list