How to remove or destroy wx.panel from its parent (another wx.panel object)?

I am developing a GUI using wxPython. I draw a square that represents a CD object inside another square (also with the wxPanel class) that represents a CD container object. I want to β€œremove this CD” in the CDWindow right-click menu, which will remove CDWindow. Basically, my code looks like this (for simplicity, I keep the main parts):

class CDContainerWindow(wx.Panel):    
   def __init__(self):
       wx.Panel.__init__(self, parent, id, pos, size)  
       cd_win=CDWindow()

class CDWindow(wx.Panel):  
   def __init__(self):
      wx.Panel.__init__(self, parent, id, pos, size)
      self.Bind(wx.EVT_MENU, self.OnDeleteCD, item_CD)

   def OnDeleteCD(self, event):
      self.destroy()

I receive a "Segmentation Error" error message, What is wrong with my path? How to remove this CD window from the CDContainer window?

+3
source share
1 answer

, sizer ? sizer.

+3

Source: https://habr.com/ru/post/1769756/


All Articles