Move a dialog to a tab and back again

I have a wx.Dialog, that I'd like to 'move' to a tab on an existing
wx.notebook. Is there an easy way to do this? I tried just
duplicating the code which is not super great, because now I have 2
copies of the same code I'd need to update (ones a panel, the other
the dialog). Can I somehow dynamically create a class to be either a
wx.Dialog or wx.Panel? Or is there a way to just 'copy' (or reassign)
a dialog to a panel (in the notebook)?

Thanks!

Hi,

I have a wx.Dialog, that I'd like to 'move' to a tab on an existing
wx.notebook. Is there an easy way to do this? I tried just
duplicating the code which is not super great, because now I have 2
copies of the same code I'd need to update (ones a panel, the other
the dialog). Can I somehow dynamically create a class to be either a
wx.Dialog or wx.Panel? Or is there a way to just 'copy' (or reassign)
a dialog to a panel (in the notebook)?

Your Dialog class should just use the Panel as its main content area.
Then you can use it in the Dialog, a Notebook, or any other container
like window class.

class MyDialog(wx.Dialog):
    def __init__(self, ...):
        ...
        self.panel = MyPanel(self)
        sizer = wx.BoxSizer()
        sizer.Add(self.panel, 1, wx.EXPAND)
        self.SetSizer(sizer)

Cody

···

On Mon, Jul 5, 2010 at 5:57 PM, Chris P <11y3y3y3y43@gmail.com> wrote:

That seems obvious, maybe I had a stroke today!
Thanks.

···

On Jul 5, 7:02 pm, Cody Precord <codyprec...@gmail.com> wrote:

Hi,
Your Dialog class should just use the Panel as its main content area.
Then you can use it in the Dialog, a Notebook, or any other container
like window class.

class MyDialog(wx.Dialog):
def __init__(self, ...):
...
self.panel = MyPanel(self)
sizer = wx.BoxSizer()
sizer.Add(self.panel, 1, wx.EXPAND)
self.SetSizer(sizer)