import wx
import wx.lib.sized_controls as sc


class MainDialog(sc.SizedDialog):

    def __init__(self, parent):
        sc.SizedDialog.__init__(self, parent, title="Dialog",
                                size=(700, 200))

        pane = self.GetContentsPane()
        pane.SetSizerType("form")

        # row 1
        wx.StaticText(pane, -1, "Main address:")
        self.main = wx.TextCtrl(pane, style=wx.TE_READONLY)
        self.main.SetSizerProps(expand=True)
        self.main.SetValue('sam@example.com')

        # row 2
        pane.Sizer.AddSpacer(1)  # THIS CAUSES WAY TOO MUCH SPACE
        #wx.StaticText(pane)  # THIS DOESN'T
        msg = "Can only be changed in the legacy program."
        wx.StaticText(pane, -1, msg) \
            .SetFont(wx.FFont(8, wx.FONTFAMILY_DEFAULT,
                              flags=wx.FONTFLAG_ITALIC))

        # row 3
        wx.StaticText(pane, -1, "Additional addresses:")
        self.addrs = wx.TextCtrl(pane)
        self.addrs.SetSizerProps(expand=True)
        self.addrs.SetValue('freda@msn.com joe@yahoo.com martha@gmail.com')
        self.addrs.SetSizerProps(expand=True)

        # row 4
        pane.Sizer.AddSpacer(1)  # THIS IS NOT A PROBLEM
        msg = "Enter multiple email addresses, separated by spaces."
        wx.StaticText(pane, -1, msg) \
            .SetFont(wx.FFont(8, wx.FONTFAMILY_DEFAULT,
                              flags=wx.FONTFLAG_ITALIC))

        self.Layout()

class MainPanel(sc.SizedPanel):

    def __init__(self, parent):
        sc.SizedPanel.__init__(self, parent)

    def show_dialog(self):
        dlg = MainDialog(self)
        dlg.ShowModal()
        dlg.Destroy()

class MainFrame(wx.Frame):

    def __init__(self, title):
        wx.Frame.__init__(self, None, -1, title, size=(800, 400))

        self.panel = MainPanel(self)
        self.Show()
        self.panel.show_dialog()

# Make the wxPython Widget Inspection Tool available via Ctrl-Alt-I
from wx.lib.mixins import inspection
app = inspection.InspectableApp(0)

frame = MainFrame("Sample")
app.SetTopWindow(frame)
app.MainLoop()
