double click on aui or agw.aui notebook tab

Hi list.

I feel like I should be able to figure this out but Googling for it
and looking through the Demo's code has somehow just confused me
further. I want to be able to bind a click event (such as left double
click) on a tab of a notebook--preferably AUINotebook or, probably
better, AGW.AUINotebook--and thereby get a reference to the notebook
page, so I can do something to it.

With wx.Notebook this can be done with HitTest() and I see there is a
TabHitTest for AUITabManager, though I couldn't find an example for
either and don't understand how to use it...(how do you know what x
and y ought to be?).

Thanks,
Che

Hi Che!

Hi list.

I feel like I should be able to figure this out but Googling for it

and looking through the Demo’s code has somehow just confused me

further. I want to be able to bind a click event (such as left double

click) on a tab of a notebook–preferably AUINotebook or, probably

better, AGW.AUINotebook–and thereby get a reference to the notebook

page, so I can do something to it.

With wx.Notebook this can be done with HitTest() and I see there is a

TabHitTest for AUITabManager, though I couldn’t find an example for

either and don’t understand how to use it…(how do you know what x

and y ought to be?).

Thanks,

Che

I think the event you want to bind to is:

import wx.lib.agw.aui as aui
aui.EVT_AUINOTEBOOK_TAB_DCLICK

In your handler, you can do something like:

x = event.GetEventObject()
tabID = x.GetId()
tab = x.FindWindowById(tabID)

I wasn’t able to find a method that actually returned the label of the tab so I knew I had the right one though. GetLabel and GetLabelText both returned “AuiTabCtrl” for some reason. I hope that gets you on the right path anyway.

  • Mike
···

On Thursday, July 26, 2012 1:10:33 AM UTC-5, Che M wrote:

Thanks, Mike.

Building on that help, what I did was:

        x = event.GetEventObject()
        tabID = x.GetId()
        tab = x.FindWindowById(tabID)
        page_index = tab.GetActivePage()
        page = self.myNotebook.GetPage(page_index)

Seems kind of roundabout and I'm sure there must be a simpler way, but
that works.

Che

Yeah, that seems too complicated to me too, but I couldn’t come up with anything else and I think Andrea is still on vacation. Hopefully he can step in this weekend or next week. I can’t remember when he gets back.

  • Mike
···

On Thursday, July 26, 2012 4:22:25 PM UTC-5, Che M wrote:

Thanks, Mike.

Building on that help, what I did was:

    x = event.GetEventObject()

    tabID = x.GetId()

    tab = x.FindWindowById(tabID)

    page_index = tab.GetActivePage()

    page = self.myNotebook.GetPage(page_index)

Seems kind of roundabout and I’m sure there must be a simpler way, but

that works.

Che

event.GetSelection() which will give you the page of the notebook tab.

also a event.GetEventObject().GetChildren() will give you a list of all the children associated with the notebook.

I may not understand what you’re trying to accomplish though, so sorry for not helping.

···

On Thursday, July 26, 2012 2:10:33 AM UTC-4, Che M wrote:

Hi list.

I feel like I should be able to figure this out but Googling for it

and looking through the Demo’s code has somehow just confused me

further. I want to be able to bind a click event (such as left double

click) on a tab of a notebook–preferably AUINotebook or, probably

better, AGW.AUINotebook–and thereby get a reference to the notebook

page, so I can do something to it.

With wx.Notebook this can be done with HitTest() and I see there is a

TabHitTest for AUITabManager, though I couldn’t find an example for

either and don’t understand how to use it…(how do you know what x

and y ought to be?).

Thanks,

Che

event.GetSelection() which will give you the page of the notebook tab.

also a event.GetEventObject().GetChildren() will give you a list of all the
children associated with the notebook.

I may not understand what you're trying to accomplish though, so sorry for
not helping.

That's the correct answer, as far as I remember :slight_smile: .
event.GetSelection() will give you the selected page (as a zero-based
index) in the AuiNotebook for which the double-click happened. Having
that information, you can simply call notebook.GetPage(selection) to
retrieve the actual (wx.Window-based) page you are looking for.

···

On 27 July 2012 07:41, Steve Freedenburg wrote:

On Thursday, July 26, 2012 2:10:33 AM UTC-4, Che M wrote:

Hi list.

I feel like I should be able to figure this out but Googling for it
and looking through the Demo's code has somehow just confused me
further. I want to be able to bind a click event (such as left double
click) on a tab of a notebook--preferably AUINotebook or, probably
better, AGW.AUINotebook--and thereby get a reference to the notebook
page, so I can do something to it.

With wx.Notebook this can be done with HitTest() and I see there is a
TabHitTest for AUITabManager, though I couldn't find an example for
either and don't understand how to use it...(how do you know what x
and y ought to be?).

Thanks,
Che

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

--
Andrea.

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

# ------------------------------------------------------------- #
def ask_mailing_list_support(email):

    if mention_platform_and_version() and include_sample_app():
        send_message(email)
    else:
        install_malware()
        erase_hard_drives()
# ------------------------------------------------------------- #