When using the flatnotebook module from the wx.lib.agw package of wxpython 4.1.1 I am encountering a reoccurring is crash when repositioning pages by dragging the tabs with my mouse. I am using python 3.9.10 on OSX 12.1 with an Apple Silicon M1 Max processor .
I can run the same code and performing the same drag operation on python 3.9.10 on Windows 10 Pro with an x86_64 processor and not experience the crash.
Test code used to replicate the error:
import wx
import wx.lib.agw.flatnotebook as FNB
class TestFrame(wx.Frame):
'''the Main GUI'''
def __init__(self, parent, title,
pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE):
wx.Frame.__init__(self, parent, title=title, pos=pos, size=size, style=style)
sizer = wx.BoxSizer()
test_FNB = FNB.FlatNotebook(parent=self)
test_panel1 = wx.Panel(self)
test_FNB.AddPage(test_panel1, "test_1")
test_panel2 = wx.Panel(self)
test_FNB.AddPage(test_panel2, "test_2")
sizer.Add(test_FNB, 1, wx.EXPAND)
self.SetSizer(sizer)
app = wx.App()
top = TestFrame(None, title="FNB Crash Test", size=(300,200))
top.Show()
app.MainLoop()
The following are the error logs from the python console:
2022-02-09 13:47:44.502 Python[84668:843497] 'FlatNotebook' is not a valid UTI string. Cannot use an invalid UTI as a type returned from -writeableTypesForPasteboard: in class wxPasteBoardWriter.
Fatal Python error: PyGILState_Release: thread state 0x11c6071a0 must be current when releasing
Python runtime state: initialized
Current thread 0x0000000101148580 (most recent call first):
File ".../lib/python3.9/site-packages/wx/lib/agw/flatnotebook.py", line 5843 in OnMouseMove
File ".../lib/python3.9/site-packages/wx/core.py", line 2237 in MainLoop
File ".../Flatnotebook_crash.py", line 29 in <module>
To avoid the crash I have disabled drag and drop in my application but I am wondering if anyone has suggestions on how to work around this issue.
Thanks