Hi there,
Once again I hve problems with the wx.aui.AuiNoteBook=). I've bound a wx.EVT_LEFT_DCLICK event to the AuiTabCtrl of my notebook. The function that is called by the event should separate which tab or if the space next the tabs is clicked. It seems that the TabHitTest function (as a property of AuiTabCtrl inherited from AuiTabContainer) could do this but I can't handle this. The parameters are bool TabHitTest(int x, int y, window hit) where x and y are no problem, but what does 'hit' mean? I've tried to commit each page of the notebook because it seems obvious that the functions returns True if x and y are inside the (tab?) window of this page. But I always get the following error:
Traceback (most recent call last):
File "C:\TAF\eclipse_workspace\TAFeditor\Test\AuiNotebook.py", line 21, in OnTest
evt.GetEventObject().TabHitTest(x,y, *[a])
File "C:\Python25\Lib\site-packages\wx-2.8-msw-unicode\wx\aui.py", line 1261, in TabHitTest
return _aui.AuiTabContainer_TabHitTest(*args, **kwargs)
TypeError: in method 'AuiTabContainer_TabHitTest', expected argument 4 of type 'wxWindow **'
This is the simple example code I'm playing with:
import wx
import wx.aui
class MyFrame(wx.Frame):
def __init__(self, prnt):
wx.Frame.__init__(self, prnt, wx.ID_ANY, "AuiNB Test")
self.myNB = wx.aui.AuiNotebook(self, wx.ID_ANY)
self.myNB.AddPage(wx.TextCtrl(self.myNB, wx.ID_ANY), "TextCtrl1")
self.myNB.AddPage(wx.TextCtrl(self.myNB, wx.ID_ANY), "TextCtrl2")
for el in self.myNB.GetChildren():
if isinstance(el, wx.aui.AuiTabCtrl):
el.Bind(wx.EVT_LEFT_DCLICK, self.OnTest)
def OnTest(self, evt):
x,y = evt.GetPosition()
for wnd in range(self.myNB.GetPageCount()):
evt.GetEventObject().TabHitTest(x,y, self.myNB.GetPage(wnd))
class BoaApp(wx.App):
def OnInit(self):
wx.InitAllImageHandlers()
self.main = MyFrame(None)
self.main.Show()
self.SetTopWindow(self.main)
return True
if __name__ == '__main__':
application = BoaApp(0)
application.MainLoop()
I hope one of you guys has a suggestion.
Tim