wxWidgets / Phoenix

wxPython's Project Phoenix. A new implementation of wxPython, better, stronger, faster than he was before.
http://wxpython.org/
2.23k stars 510 forks source link

how can i hide the button on wx.GenericDirCtrl tree? #2550

Open dw-choi-1105 opened 1 month ago

dw-choi-1105 commented 1 month ago

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

  1. multi-selected some folders, and then collapsed the node by clicking - button
  2. expand the node by clicking + button
  3. re multi-selected some folders as i selected in step 1
  4. 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) ```python # 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) ```