AW: [GREY] Dynamically add panels to wx.Dialog

image001.png

Im Auftrag von daniel d

image004.jpg

image005.jpg

···

Hello,

My program frame contains panels which I would like to either copy or move into a wx.Dialog. When I try to do this, the panel does not get placed inside the wx.Dialog window.

In my example app I click “Add Panel” 3 times and it looks like this

When I click “Open Dialog”, it is supposed to create a new dialog and put TEST PANEL 0 in the dialog. Instead, TEST PANEL 0 appears to be placed inside the program frame.

How can I get TEST PANEL 0 inside the dialog window? I have attached all the code in dialog_test.zip.

My main module code is below. See zip file for GUI setup.

**import** wx
**import** gui
**class** ProgramFrame(gui.MainFrame):
    **def** __init__(self,parent):
        gui.MainFrame.__init__(self,parent)
        self.num_main_panels = 0
        self.panels = []
   
    **def** OnButtonClick_addPanel( self, event ):
        panel = gui.TestPanel(self)
        panel.m_staticText_idx.SetLabelText(str(self.num_main_panels))
        self.num_main_panels = self.num_main_panels +1
        sizer = self.m_main_panel.GetSizer()
        sizer.Add(panel, 1, wx.EXPAND|wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 5 )
        self.panels.append(panel)
        panel.Show()
        *# sizer.Layout()
       * self.Fit()
        self.Layout()
        event.Skip()
       
    **def** OnButtonClick_openDialog( self, event ):
        dlg = gui.TestDialog(self)
        sizer = dlg.GetSizer()
        sizer.Add(self.panels[0], 1, wx.EXPAND|wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 5 )
        dlg.Fit()
        dlg.Layout()
        dlg.Show()
        event.Skip()
*# -----------------------------------------------------------------------------***if** __name__ == **'__main__'**:
    *# create app
   * app = wx.App(False)
    *# create frame
   * frame = ProgramFrame(None)
    *# show the frame
   * frame.Show(True)
    app.MainLoop()

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
wxpython-users+unsubscribe@googlegroups.com.
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

</details>