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
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.