[wxPython] Sash/Splitter bug in wxPython 2.3.2.1 and 2.3.3pre3 not in 2.3.1

Sash/Splitter bug in wxPython 2.3.2.1 and 2.3.3pre3 not in 2.3.1
Hi folks,

I’ve been having a problem with wxPython 2.3.2.1 and 2.3.3pre3 that I didn’t have with 2.3.1. I’ve included a program that recreates the problem.

Briefly, I’m trying to create an MDI application where the main frame is divided into client area and a sash, using a wxSashLayoutWindow. The sash is split into two windows using a wxSplitterWindow. The problem occurs when the mouse cursor is slowly moved from the client area into the sash area. While in the client area, an arrow cursor is displayed, then it changes to a “horizontal sizing” cursor (while crossing the sash frame), then the arrow cursor re-appears, and finally the “horizontal sizing” cursor returns. The final transition to “horizontal sizing” cursor is the bug. The bug does not manifest when the mouse is moved quickly.

Is this a bug in wxPython, or am I using a wxSashLayoutWindow and wxSplitterWindow in an invalid way?

Is there a workaround that uses a different combination of sashes and splitters? I think that I initially tried using a sash within a sash, but that didn’t work.

Any examples of how to split an MDI application up the way that I’m trying?

Should I enter a bug report, or will the person that verifies that it is a bug do this?

Thanks in advance,

Matthew

···

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

#!/usr/bin/env python

1) Create a wxMDIParentFrame as the main window

2) Split main window with a wxSashLayoutWindow on the left

3) Split the sash into a top and botton portion using a wxSplitterWindow

4) Add wxNotebook’s to the top and bottom parts of the sash

5) Add a wxScrolledWindow page to each wxNotebook

from wxPython.wx import *

class MainFrame(wxMDIParentFrame):

    def __init__(self, parent, id, title):

            wxMDIParentFrame.__init__(self, parent, id, title, size=(800, 600))

           
            ID_WINDOW_LEFT = wxNewId()

           
            # A sash to the left of the client window

            self.sashLeft = wxSashLayoutWindow(self, ID_WINDOW_LEFT, style = wxNO_BORDER|wxSW_3D)

            self.sashLeft.SetDefaultSize((250, -1))

            self.sashLeft.SetOrientation(wxLAYOUT_VERTICAL)

            self.sashLeft.SetAlignment(wxLAYOUT_LEFT)

            self.sashLeft.SetSashVisible(wxSASH_RIGHT, TRUE)

           
            EVT_SIZE(self, self.OnSize)

            EVT_SASH_DRAGGED(self, ID_WINDOW_LEFT, self.OnSashLeftDrag)

           
            ##########################

            # Create a splitter that divides the sash into two windows

            sashSplitter = wxSplitterWindow(self.sashLeft, -1, style=wxNO_3D|wxSP_3D)

           
            # Create a notebook for the top part of the splitter

            notebookTop = wxNotebook(sashSplitter, -1, style=wxCLIP_CHILDREN)

            page = wxScrolledWindow(notebookTop)

            notebookTop.AddPage(page, 'Page 1')

           
            # Create a notebook for the bottom part of the splitter

            notebookBottom = wxNotebook(sashSplitter, -1, style=wxCLIP_CHILDREN)

            page = wxScrolledWindow(notebookBottom)

            notebookBottom.AddPage(page, 'Page 1')

           
            # add the windows to the splitter and split it.

            sashSplitter.SplitHorizontally(notebookTop, notebookBottom)

            sashSplitter.SetSashPosition(400, true)

            sashSplitter.SetMinimumPaneSize(35)

   
    def OnSashLeftDrag(self, event):

            if event.GetDragStatus() == wxSASH_STATUS_OUT_OF_RANGE:

                    return

           
            sashSize = (event.GetDragRect().width, -1)

            self.sashLeft.SetDefaultSize(sashSize)

            wxLayoutAlgorithm().LayoutMDIFrame(self)

            self.GetClientWindow().Refresh()

def OnSize(self, event):

            wxLayoutAlgorithm().LayoutMDIFrame(self)

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

class MyApp(wxApp):

    def __init__(self, num, bOutputWindow = true):

            wxApp.__init__(self, num)

           
    def OnInit(self):

            wxInitAllImageHandlers()

            mainFrame = MainFrame(None, -1, "Cursor Bug")

           
            mainFrame.Show(true)

            self.SetTopWindow(mainFrame)

            return true

def main():

    app = MyApp(0)

    app.MainLoop()

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

if name == ‘main’:

    main()

Briefly, I'm trying to create an MDI application where the main frame is
divided into client area and a sash, using a wxSashLayoutWindow. The sash

is

split into two windows using a wxSplitterWindow. The problem occurs when

the

mouse cursor is slowly moved from the client area into the sash area.

While

in the client area, an arrow cursor is displayed, then it changes to a
"horizontal sizing" cursor (while crossing the sash frame), then the arrow
cursor re-appears, and finally the "horizontal sizing" cursor returns. The
final transition to "horizontal sizing" cursor is the bug. The bug does

not

manifest when the mouse is moved quickly.

I'm not sure the cause. Go ahead and enter a bug report about this.

As a workaround you can just set the cursor for the notebook page windows:

    page.SetCursor(wxSTANDARD_CURSOR)

···

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!