EVT_LEAVE_WINDOW Test

Hi folks,

I bother you again; this time I have a wxFrame containing a wxNotebook with a single page. On this page are two buttons. Why the focus can't be switched from button2 to button1 when pressing "Tab" (or from button1 to button 2 with "Shift-Tab")? Is there any workaround for this?

It has to do with the notebook because for a simple panel it works.

Thank you,

Cristina.

···

-------------------
from wxPython.wx import *

class MyFrame(wxFrame):
     def __init__(self, parent):
         wxFrame.__init__(self, parent, -1, "Test for Tab navigation on a Notebook", size=(400,200))
         self.notebook = wxNotebook(self, -1, style=0)
         self.pane = wxPanel(self.notebook, -1)
         self.button1 = wxButton(self.pane, -1, "button1")
         self.button2 = wxButton(self.pane, -1, "button2")

         sizer = wxBoxSizer(wxVERTICAL)
         sizer_3 = wxBoxSizer(wxVERTICAL)
         sizer_3.Add(self.button1, 0, wxALL, 20)
         sizer_3.Add(self.button2, 0, wxALL, 20)
         self.pane.SetAutoLayout(1)
         self.pane.SetSizer(sizer_3)
         self.notebook.AddPage(self.pane, "tab1")
         sizer.Add(wxNotebookSizer(self.notebook), 1, wxEXPAND, 0)
         self.SetAutoLayout(1)
         self.SetSizer(sizer)
         self.Layout()

#---------------------------------------------------------------------------

if __name__ == '__main__':
     import sys
     app = wxPySimpleApp()
     frame = MyFrame(None)
     frame.Show(true)
     app.MainLoop()

Unfortunately, I wasn't able to try this earlier, but your
orginal EVT_LEAVE_WINDOW example below DOES work just fine.

That is with wxPython2.4.1.2/Python2.3.1 on RedHat8/GTK2.

/Jean Brouwers

C. Iacob wrote:

···

Hi folks,

I bother you again; this time I have a wxFrame containing a wxNotebook with a single page. On this page are two buttons. Why the focus can't be switched from button2 to button1 when pressing "Tab" (or from button1 to button 2 with "Shift-Tab")? Is there any workaround for this?

It has to do with the notebook because for a simple panel it works.

Thank you,

Cristina.
-------------------
from wxPython.wx import *

class MyFrame(wxFrame):
    def __init__(self, parent):
        wxFrame.__init__(self, parent, -1, "Test for Tab navigation on a Notebook", size=(400,200))
        self.notebook = wxNotebook(self, -1, style=0)
        self.pane = wxPanel(self.notebook, -1)
        self.button1 = wxButton(self.pane, -1, "button1")
        self.button2 = wxButton(self.pane, -1, "button2")

        sizer = wxBoxSizer(wxVERTICAL)
        sizer_3 = wxBoxSizer(wxVERTICAL)
        sizer_3.Add(self.button1, 0, wxALL, 20)
        sizer_3.Add(self.button2, 0, wxALL, 20)
        self.pane.SetAutoLayout(1)
        self.pane.SetSizer(sizer_3)
        self.notebook.AddPage(self.pane, "tab1")
        sizer.Add(wxNotebookSizer(self.notebook), 1, wxEXPAND, 0)
        self.SetAutoLayout(1)
        self.SetSizer(sizer)
        self.Layout()

#---------------------------------------------------------------------------

if __name__ == '__main__':
    import sys
    app = wxPySimpleApp()
    frame = MyFrame(None)
    frame.Show(true)
    app.MainLoop()

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org

Hi,

What platform are you using? It works fine on my Win2Kpro, Python2.2, wxPython2.4.2.

Derrick

C. Iacob wrote:

···

Hi folks,

I bother you again; this time I have a wxFrame containing a wxNotebook with a single page. On this page are two buttons. Why the focus can't be switched from button2 to button1 when pressing "Tab" (or from button1 to button 2 with "Shift-Tab")? Is there any workaround for this?

It has to do with the notebook because for a simple panel it works.

Thank you,

Cristina.
-------------------
from wxPython.wx import *

class MyFrame(wxFrame):
    def __init__(self, parent):
        wxFrame.__init__(self, parent, -1, "Test for Tab navigation on a Notebook", size=(400,200))
        self.notebook = wxNotebook(self, -1, style=0)
        self.pane = wxPanel(self.notebook, -1)
        self.button1 = wxButton(self.pane, -1, "button1")
        self.button2 = wxButton(self.pane, -1, "button2")

        sizer = wxBoxSizer(wxVERTICAL)
        sizer_3 = wxBoxSizer(wxVERTICAL)
        sizer_3.Add(self.button1, 0, wxALL, 20)
        sizer_3.Add(self.button2, 0, wxALL, 20)
        self.pane.SetAutoLayout(1)
        self.pane.SetSizer(sizer_3)
        self.notebook.AddPage(self.pane, "tab1")
        sizer.Add(wxNotebookSizer(self.notebook), 1, wxEXPAND, 0)
        self.SetAutoLayout(1)
        self.SetSizer(sizer)
        self.Layout()

#---------------------------------------------------------------------------

if __name__ == '__main__':
    import sys
    app = wxPySimpleApp()
    frame = MyFrame(None)
    frame.Show(true)
    app.MainLoop()

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org