how can i hide the button on wx.GenericDirCtrl tree?
Operating system: windows 10 wxPython version & source: wxpython 4.2.1 Python version & source: Python 3.11.8
Description of the problem: i found the bug in the button on tree control of wx.GenericDirCtrl. (exactly +/- button)
That is bug scenario in wx.GenericDirctrl
- multi-selected some folders, and then collapsed the node by clicking - button
- expand the node by clicking + button
- re multi-selected some folders as i selected in step 1
- click the parent node of nodes that i selected in step 3
then bug will be occured, and python crash, app crash occured. i found that these phenomenon is only occured when i cliecked the +/- button to expand or collapse the nodes (that is also occured in GenericDirCtrl demo code of wxpython 4.2.1)
so that reason, i want to hide the button of wx.GenericDirCtrl tree for avoiding this phenomenon is there any method to deal with this problem? that is the my code to hide GenericDirCtrl button, but it was not working
Code Example (click to expand)
# Put code sample here
class TestPanel(wx.Panel):
def __init__(self, parent, log):
wx.Panel.__init__(self, parent, -1)
self.log = log
txt1 = wx.StaticText(self, -1, "style=0")
dir1 = wx.GenericDirCtrl(self, -1, size=(200,225), style=0)
txt2 = wx.StaticText(self, -1, "wx.DIRCTRL_DIR_ONLY")
dir2 = wx.GenericDirCtrl(self, -1, size=(200,225), style=wx.DIRCTRL_DIR_ONLY)
txt3 = wx.StaticText(self, -1, "wx.DIRCTRL_SHOW_FILTERS\nwx.DIRCTRL_3D_INTERNAL\nwx.DIRCTRL_MULTIPLE")
self.dir3 = wx.GenericDirCtrl(self, -1, size=(200,225),
style=(wx.DIRCTRL_SHOW_FILTERS |
wx.DIRCTRL_3D_INTERNAL |
wx.DIRCTRL_MULTIPLE
) & ~wx.DIRCTRL_SHOW_FILTERS,
filter="All files (*.*)|*.*|Python files (*.py)|*.py")
# test
self.dir3.TreeCtrl.SetWindowStyle(wx.DIRCTRL_3D_INTERNAL & ~wx.TR_HAS_BUTTONS)
This is a crash bug that affects GenericDirCtrl when multiple selection is enabled. Also affects other controls that use this internally such as MultiDirDialog.
Can be seen in the demo by going into a folder, selecting multiple items, closing the folder and opening it back up and selecting items again. Might have to repeat these steps multiple times before it crashes.
Bug affects: wxPython v4.1.1 msw (phoenix) wxWidgets v3.1.5 wxPython v4.2.1 msw (phoenix) wxWidgets v3.2.2.1 wxPython v4.2.3 msw (phoenix) wxWidgets v3.2.7
https://github.com/user-attachments/assets/f5c6ce8e-eb70-4cd5-b14e-10c8371eed0c