2

I'm currently using wx.SpliterWindow in my wxpython application. When I run the application, the GUI appears fine. However, when I attempt to move the divider between the parts of the splitter window, multiple weird horizontal multicolored glitches appear. They continue to appear wherever I move the divider. Once I release the divider, the glitches disappear. (I attempted to upload a picture or GIF of this behavior, but the glitches disappear too quickly to be captured. If I'm able to make a picture or GIF , I'll post it.)

Here is the code I'm running:

import wx


class Panel1(wx.Panel):
    def __init__(self, parent, *args, **kwargs):
        super().__init__(parent=parent, *args, **kwargs)
        self.SetBackgroundColour((0, 0, 255))


class Panel2(wx.Panel):
    def __init__(self, parent, *args, **kwargs):
        super().__init__(parent=parent, *args, **kwargs)
        self.SetBackgroundColour((0, 255, 0))


class Frame(wx.Frame):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        splitter = wx.SplitterWindow(self)
        panel1 = Panel1(splitter)
        panel2 = Panel2(splitter)

        splitter.SplitHorizontally(panel1, panel2)
        splitter.SetMinimumPaneSize(20)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(splitter, 1, wx.EXPAND)
        self.SetSizer(sizer)


class App(wx.App):
    def OnInit(self):
        editor = Frame(None, title='wxPython')
        editor.Show()
        return True


if __name__ == '__main__':
    app = App(False)
    app.MainLoop()

Is this behavior a know bug when using wx.SplitterWindow on certian platforms? I couldn't find anything on wxPython's issues page.

Here are my specifications

  • Windows 10.0
  • Python 3.6.1
  • wxPython 4.0.0b2
Christian Dean
  • 22,138
  • 7
  • 54
  • 87
  • 1
    I can only guess that maybe calling `SetDoubleBuffered(True)` on `splitter`, the panels or the frame itself may help. – Michael Butscher Jan 23 '18 at 00:29
  • Thanks for the tip @MichaelButscher. Unfortunately, it didn't work. I'll keep looking around the wxPython docs though. Maybe something will turn up. – Christian Dean Jan 23 '18 at 00:38

1 Answers1

2

It's not a bug,just set flag wxSP_LIVE_UPDATE. In DOC,this flag will

Don't draw XOR line but resize the child windows immediately.

In python, just write this splitter = wx.SplitterWindow(self, style = wx.SP_LIVE_UPDATE),then it will perform normal.

obgnaw
  • 3,007
  • 11
  • 25
  • Thanks @obgnaw, Your that worked perfectly! I'm not very well versed in the wxPython library. I guess I missed that part of the docs. I'll award the bounty after the minimum bounty period of 1 day is up (about three hours from now). – Christian Dean Feb 08 '18 at 23:20
  • anytime @ChristianDean It's from wxWidgets's DOC,maybe that's why you miss it. – obgnaw Feb 12 '18 at 02:53
  • I also see the issue in C++ application, see my report here: https://groups.google.com/d/msg/wx-users/f-KzNnrjKZ8/pxIJ8F1XAAAJ and there is also a screen shot. Only one line is shown. Do you see the XOR line(as you said the glitches) shown correctly? – ollydbg23 Feb 24 '18 at 03:30