选择不同选项时 wxpython 小部件无法正确调整大小

wxpython widgets resizing not properly when selecting different choices

import wx, wx.lib.mixins.listctrl as wxlc
import wx.lib.buttons as buttons
from datetime import date

today_date = date.today().strftime('%Y %m %d')


class BetaFrame(wx.Frame):

    def __init__(self, parent, title):
        super().__init__(parent, -1, title=title, size=(1000, 1000))


        self.initpos = 350
        self.sp = wx.SplitterWindow(self)
        self.p1 = wx.Panel(self.sp, style=wx.SUNKEN_BORDER)
        self.p2 = wx.Panel(self.sp, style=wx.SUNKEN_BORDER, name='Plot')

        self.p1.SetBackgroundColour('light')
        self.p2.SetBackgroundColour('light')

        # self.InitializeComponents()

        self.sp.SplitVertically(self.p1, self.p2, self.initpos)
        self.Centre()

        self.sizer = wx.GridBagSizer(10, 10)
        self.create_text_buttons()
        self.p1.SetSizer(self.sizer)



    def create_text_buttons(self):


        self.font1 = wx.Font(16, wx.MODERN, wx.NORMAL, wx.NORMAL, False)
        self.font2 = wx.Font(12, wx.MODERN, wx.NORMAL, wx.NORMAL, False)
        self.font3 = wx.Font(10, wx.MODERN, wx.NORMAL, wx.NORMAL, False)

        hbox0 = wx.BoxSizer(wx.HORIZONTAL)
        run = wx.StaticText(self.p1, label='Data Source')
        run.SetFont(self.font2)
        hbox0.Add(run, flag=wx.TOP | wx.LEFT | wx.BOTTOM,
                 border=10)

        self.choType = wx.Choice(self.p1, choices=['Single Date',
                                                'Multiple Dates'])
        self.choType.SetFont(self.font2)
        self.choType.SetSelection(0)
        hbox0.Add(self.choType, flag=wx.TOP | wx.LEFT | wx.BOTTOM,
                  border=10)
        self.choType.Bind(wx.EVT_CHOICE, self.choType_change)
        self.sizer.Add(hbox0, pos=(0, 0), span=(1, 2), flag=wx.EXPAND | wx.BOTTOM, border=10)


        #### Create Date
        hbox = wx.BoxSizer(wx.HORIZONTAL)
        self.set_date = wx.StaticText(self.p1, -1, label='Date(20XX XX XX)')
        self.set_date.SetFont(self.font2)
        hbox.Add(self.set_date, flag=wx.TOP | wx.LEFT | wx.BOTTOM,
                 border=10)
        self.input_date = wx.TextCtrl(self.p1, -1, today_date)
        self.input_date.SetFont(self.font2)
        hbox.Add(self.input_date, flag=wx.TOP | wx.LEFT | wx.BOTTOM,
                 border=10)

        self.sizer.Add(hbox, pos=(1, 0), span=(1, 2), flag=wx.EXPAND | wx.BOTTOM, border=10)

        # Create ID
        hbox1 = wx.BoxSizer(wx.HORIZONTAL)
        self.set_ID = wx.StaticText(self.p1, -1, 'ID(XX, XX-XX)')
        self.set_ID.SetFont(wx.Font(11, wx.MODERN, wx.NORMAL, wx.NORMAL, False))
        hbox1.Add(self.set_ID, flag=wx.TOP | wx.LEFT | wx.BOTTOM,
                  border=10)

        self.input_ID = wx.TextCtrl(self.p1)
        self.input_ID.SetFont(wx.Font(11, wx.MODERN, wx.NORMAL, wx.NORMAL, False))

        hbox1.Add(self.input_ID, flag=wx.TOP | wx.LEFT | wx.BOTTOM,
                  border=10)

        self.sizer.Add(hbox1, pos=(2, 0), span=(1, 5), flag=wx.EXPAND | wx.BOTTOM, border=10)

        self.lstEnum = EditListCtrl(self.p1, -1)
        self.lstEnum.InsertColumn(0, 'YEAR')
        self.lstEnum.InsertColumn(1, 'MMDD')
        self.lstEnum.InsertColumn(2, 'ID')

        table_width = self.lstEnum.GetSize()[0]  # GetSize returns (width, height) tuple
        num_col = self.lstEnum.GetColumnCount()
        col_width = int(table_width / num_col)
        self.lstEnum.SetColumnWidth(0, col_width)
        self.lstEnum.SetColumnWidth(1,col_width)
        self.lstEnum.SetColumnWidth(2, table_width-2*col_width)
        self.lstEnum.SetFont(self.font2)

        self.lstEnum.setResizeColumn(0)
        self.lstEnum.Append(['', '', ''])
        self.lstEnum.SetInitialSize((100, 240))
        self.sizer.Add(self.lstEnum, (3, 0), span=(1, 2), flag=wx.EXPAND | wx.LEFT | wx.BOTTOM, border=10)


        self.btnAdd = wx.Button(self.p1, label='Add')
        self.btnAdd.SetFont(self.font3)
        self.btnAdd.Bind(wx.EVT_BUTTON, self.btnAdd_click)
        self.btnRemove = wx.Button(self.p1, label='Remove')
        self.btnRemove.SetFont(self.font3)
        self.btnRemove.Bind(wx.EVT_BUTTON, self.btnRemove_click)
        self.sizer.Add(self.btnAdd, (4, 0), flag=wx.LEFT | wx.BOTTOM, border=10)
        self.sizer.Add(self.btnRemove, (4, 1))


        line = wx.StaticLine(self.p1)
        self.sizer.Add(line, (5, 0), span=(1, 15), flag=wx.EXPAND)

        toggle_autoplot = buttons.GenToggleButton(self.p1, label='Automatically Plot')
        toggle_autoplot.SetFont(wx.Font(12, wx.MODERN, wx.NORMAL, wx.BOLD, False))
        toggle_autoplot.SetBezelWidth(3)
        toggle_autoplot.SetBackgroundColour('green')

        self.sizer.Add(toggle_autoplot, (6, 0), span=(1, 2), flag=wx.EXPAND | wx.LEFT, border=10)


        #### Customize Y axis

        self.st2 = wx.StaticBox(self.p1, label='Customize Y Axis')
        self.st2.SetFont(self.font2)

        boxsizer = wx.StaticBoxSizer(self.st2, wx.VERTICAL)
        self.cb1 = wx.CheckBox(self.p1, label='Plunge Depth (in)')
        self.cb1.SetFont(self.font3)
        boxsizer.Add(self.cb1, flag=wx.LEFT | wx.BOTTOM, border=5)


        self.cb2 = wx.CheckBox(self.p1, label='Captured Force (lb')
        self.cb2.SetFont(self.font3)
        boxsizer.Add(self.cb2, flag=wx.LEFT | wx.BOTTOM, border=5)

        self.cb3 =  wx.CheckBox(self.p1, label='Plunge Speed (ipm)')
        self.cb3.SetFont(self.font3)
        boxsizer.Add(self.cb3, flag= wx.LEFT | wx.BOTTOM, border=5)

        self.cb4 = wx.CheckBox(self.p1, label='Rotation Speed (rpm)')
        self.cb4.SetFont(self.font3)
        boxsizer.Add(self.cb4, flag=wx.LEFT | wx.BOTTOM, border=5)

        self.cb5 = wx.CheckBox(self.p1, label='Torque ( lb in)')
        self.cb5.SetFont(self.font3)
        boxsizer.Add(self.cb5, flag=wx.LEFT | wx.BOTTOM, border=5)

        # self.Bind(wx.EVT_CHECKBOX, self.OnOneCheck)
        self.sizer.Add(boxsizer, pos=(8, 0), flag=wx.LEFT | wx.BOTTOM, border=5)

        #### PostProcessing

        self.ps = wx.StaticBox(self.p1, label='Post Processing')
        self.ps.SetFont(self.font2)

        boxsizer1 = wx.StaticBoxSizer(self.ps, wx.VERTICAL)
        self.ps1 = wx.CheckBox(self.p1, label='Maximum Captured Force (lb)')
        self.ps1.SetFont(self.font3)
        boxsizer1.Add(self.ps1, flag=wx.LEFT| wx.BOTTOM, border=5)

        self.ps2 = wx.CheckBox(self.p1, label='Force at Maximum Depth (lb)')
        self.ps2.SetFont(self.font3)
        boxsizer1.Add(self.ps2, flag=wx.LEFT| wx.BOTTOM, border=5)

        self.ps3 = wx.CheckBox(self.p1, label='Force of Overshooting (lb)')
        self.ps3.SetFont(self.font3)
        boxsizer1.Add(self.ps3, flag=wx.LEFT| wx.BOTTOM , border=5)

        # self.Bind(wx.EVT_CHECKBOX, self.OnOneCheck)
        self.sizer.Add(boxsizer1, pos=(9, 0), flag=wx.LEFT| wx.BOTTOM, border=5)




        #### Plot Types ####
        hbox2 = wx.BoxSizer(wx.HORIZONTAL)
        self.text_pottype = wx.StaticText(self.p1, label='Plot Types')
        self.text_pottype.SetFont(self.font2)
        hbox2.Add(self.text_pottype, flag=wx.TOP | wx.LEFT | wx.BOTTOM, border=10)

        self.plottype = wx.Choice(self.p1, choices=['Default Plot', 'Customized Plot', 'Post Processing'])
        self.plottype.SetSelection(0)

        # self.default_plot()
        #
        self.Bind(wx.EVT_CHOICE, self.plottype_change)


        self.plottype.SetFont(self.font2)
        hbox2.Add(self.plottype, flag=wx.TOP | wx.LEFT | wx.BOTTOM, border=10)
        self.sizer.Add(hbox2, pos=(7, 0), span=(1, 2), flag=wx.EXPAND | wx.BOTTOM, border=10)
        # self.UpdateFields_2()

        #### Add lines
        st3 = wx.StaticBox(self.p1, label='Add Lines')
        st3.SetFont(self.font2)

        boxsizer = wx.StaticBoxSizer(st3, wx.VERTICAL)
        hbox3 =  wx.BoxSizer(wx.HORIZONTAL)
        self.cb11 = wx.StaticText(self.p1, label='Time (s)')
        self.cb11.SetFont(self.font3)
        hbox3.Add(self.cb11, flag=wx.LEFT | wx.TOP, border=5)
        self.cb11_1 = wx.TextCtrl(self.p1)
        self.cb11_1.SetFont(self.font3)
        hbox3.Add(self.cb11_1, flag=wx.LEFT |wx.TOP, border=5)
        boxsizer.Add(hbox3, wx.LEFT | wx.TOP, border=5)
        boxsizer.SetMinSize(wx.Size(25, 25))

        hbox4 = wx.BoxSizer(wx.HORIZONTAL)
        self.cb12 = wx.StaticText(self.p1, label='Plunge Depth (in)')
        self.cb12.SetFont(self.font3)
        hbox4.Add(self.cb12, flag=wx.LEFT | wx.TOP, border=5)
        self.cb12_1 = wx.TextCtrl(self.p1)
        self.cb12_1.SetFont(self.font3)
        hbox4.Add(self.cb12_1, flag=wx.LEFT |wx.TOP, border=5)
        boxsizer.Add(hbox4, wx.LEFT | wx.TOP, border=5)



        # self.Bind(wx.EVT_CHECKBOX, self.OnOneCheck)
        self.sizer.Add(boxsizer, pos=(10, 0), flag=wx.TOP | wx.LEFT | wx.BOTTOM, border=5)

        run_button = buttons.GenButton(self.p1, label='Run')
        run_button.SetFont(self.font1)
        run_button.SetBezelWidth(3)
        run_button.SetBackgroundColour('green')
        run_button.SetForegroundColour('black')

        self.sizer.Add(run_button, pos=(11, 0), flag= wx.LEFT, border=10)




        self.p1.SetSizer(self.sizer)

        self.UpdateFields()
        self.UpdateFields_2()



    def choType_change(self, e):
        self.UpdateFields()


    def plottype_change(self, e):
        self.UpdateFields_2()
        # self.Maximize()



    def UpdateFields(self):
        isDistr = self.choType.GetSelection() == 0

        self.set_date.Show(isDistr)
        self.input_date.Show(isDistr)
        self.set_ID.Show(isDistr)
        self.input_ID.Show(isDistr)
        self.lstEnum.Show(not isDistr)
        self.btnAdd.Show(not isDistr)
        self.btnRemove.Show(not isDistr)
        self.p1.SetSizerAndFit(self.sizer)

    def UpdateFields_2(self):
        n = self.plottype.GetSelection()
        if n == 0:
            self.st2.Show(False)
            self.cb1.Show(False)
            self.cb2.Show(False)
            self.cb3.Show(False)
            self.cb4.Show(False)
            self.cb5.Show(False)
            self.ps.Show(False)
            self.ps1.Show(False)
            self.ps2.Show(False)
            self.ps3.Show(False)

        elif n == 1:
            self.st2.Show(True)
            self.cb1.Show(True)
            self.cb2.Show(True)
            self.cb3.Show(True)
            self.cb4.Show(True)
            self.cb5.Show(True)
            self.ps.Show(False)
            self.ps1.Show(False)
            self.ps2.Show(False)
            self.ps3.Show(False)

        elif n == 2:
            self.st2.Show(False)
            self.cb1.Show(False)
            self.cb2.Show(False)
            self.cb3.Show(False)
            self.cb4.Show(False)
            self.cb5.Show(False)
            self.ps.Show(True)
            self.ps1.Show(True)
            self.ps2.Show(True)
            self.ps3.Show(True)
        self.p1.SetSizerAndFit(self.sizer)


    def btnAdd_click(self, e):
        self.lstEnum.Append(['', '', ''])
        for i in range(self.lstEnum.GetItemCount() - 1):
            self.lstEnum.Select(i, 0)
        self.lstEnum.Select(self.lstEnum.GetItemCount() - 1)

    def btnRemove_click(self, e):
        item = self.lstEnum.GetFirstSelected()
        while item != -1:
            self.lstEnum.DeleteItem(item)
            item = self.lstEnum.GetFirstSelected()



class EditListCtrl(wx.ListCtrl, wxlc.TextEditMixin,
                               wxlc.ListCtrlAutoWidthMixin):
    def __init__(self, parent, id=-1, pos=wx.DefaultPosition,
                             size=wx.DefaultSize, style=wx.LC_REPORT):
        wx.ListCtrl.__init__(self, parent, id, pos, size, style | wx.LC_REPORT)
        wxlc.TextEditMixin.__init__(self)
        wxlc.ListCtrlAutoWidthMixin.__init__(self)


if __name__ == '__main__':
    app = wx.App()
    frame = BetaFrame(None, 'Beta Version')
    frame.Show()
    app.SetTopWindow(frame)
    app.MainLoop()

我对小部件的外观有疑问。当我玩选择时,小部件的大小搞砸了。我用了SetSizerAndFit,我想是因为当它从大区域的选择变成小区域的选择时,window还在试图适应之前的window。我尝试不使用 SetSizerAndFit,然后当我单击选项时,小部件将显示在顶角。

如果有人能提供一些建议,我将不胜感激!

我不清楚我到底在看什么,但根据最佳猜测,我怀疑您需要将 SetSizerAndFit 条目替换为 self.p1.Layout() 并且您可能需要将 wx.EXPAND 标志添加到 boxsizer 条目或选择不同的 sizer 类型。

import wx, wx.lib.mixins.listctrl as wxlc
import wx.lib.buttons as buttons
from datetime import date

today_date = date.today().strftime('%Y %m %d')


class BetaFrame(wx.Frame):

    def __init__(self, parent, title):
        super().__init__(parent, -1, title=title, size=(1000, 1000))


        self.initpos = 350
        self.sp = wx.SplitterWindow(self)
        self.p1 = wx.Panel(self.sp, style=wx.SUNKEN_BORDER)
        self.p2 = wx.Panel(self.sp, style=wx.SUNKEN_BORDER, name='Plot')

        self.p1.SetBackgroundColour('light')
        self.p2.SetBackgroundColour('light')

        # self.InitializeComponents()

        self.sp.SplitVertically(self.p1, self.p2, self.initpos)
        self.Centre()

        self.sizer = wx.GridBagSizer(10, 10)
        self.create_text_buttons()
        self.p1.SetSizer(self.sizer)



    def create_text_buttons(self):


        self.font1 = wx.Font(16, wx.MODERN, wx.NORMAL, wx.NORMAL, False)
        self.font2 = wx.Font(12, wx.MODERN, wx.NORMAL, wx.NORMAL, False)
        self.font3 = wx.Font(10, wx.MODERN, wx.NORMAL, wx.NORMAL, False)

        hbox0 = wx.BoxSizer(wx.HORIZONTAL)
        run = wx.StaticText(self.p1, label='Data Source')
        run.SetFont(self.font2)
        hbox0.Add(run, flag=wx.TOP | wx.LEFT | wx.BOTTOM,
                 border=10)

        self.choType = wx.Choice(self.p1, choices=['Single Date',
                                                'Multiple Dates'])
        self.choType.SetFont(self.font2)
        self.choType.SetSelection(0)
        hbox0.Add(self.choType, flag=wx.TOP | wx.LEFT | wx.BOTTOM,
                  border=10)
        self.choType.Bind(wx.EVT_CHOICE, self.choType_change)
        self.sizer.Add(hbox0, pos=(0, 0), span=(1, 2), flag=wx.EXPAND | wx.BOTTOM, border=10)


        #### Create Date
        hbox = wx.BoxSizer(wx.HORIZONTAL)
        self.set_date = wx.StaticText(self.p1, -1, label='Date(20XX XX XX)')
        self.set_date.SetFont(self.font2)
        hbox.Add(self.set_date, flag=wx.TOP | wx.LEFT | wx.BOTTOM,
                 border=10)
        self.input_date = wx.TextCtrl(self.p1, -1, today_date)
        self.input_date.SetFont(self.font2)
        hbox.Add(self.input_date, flag=wx.TOP | wx.LEFT | wx.BOTTOM,
                 border=10)

        self.sizer.Add(hbox, pos=(1, 0), span=(1, 2), flag=wx.EXPAND | wx.BOTTOM, border=10)

        # Create ID
        hbox1 = wx.BoxSizer(wx.HORIZONTAL)
        self.set_ID = wx.StaticText(self.p1, -1, 'ID(XX, XX-XX)')
        self.set_ID.SetFont(wx.Font(11, wx.MODERN, wx.NORMAL, wx.NORMAL, False))
        hbox1.Add(self.set_ID, flag=wx.TOP | wx.LEFT | wx.BOTTOM,
                  border=10)

        self.input_ID = wx.TextCtrl(self.p1)
        self.input_ID.SetFont(wx.Font(11, wx.MODERN, wx.NORMAL, wx.NORMAL, False))

        hbox1.Add(self.input_ID, flag=wx.TOP | wx.LEFT | wx.BOTTOM,
                  border=10)

        self.sizer.Add(hbox1, pos=(2, 0), span=(1, 5), flag=wx.EXPAND | wx.BOTTOM, border=10)

        self.lstEnum = EditListCtrl(self.p1, -1)
        self.lstEnum.InsertColumn(0, 'YEAR')
        self.lstEnum.InsertColumn(1, 'MMDD')
        self.lstEnum.InsertColumn(2, 'ID')

        table_width = self.lstEnum.GetSize()[0]  # GetSize returns (width, height) tuple
        num_col = self.lstEnum.GetColumnCount()
        col_width = int(table_width / num_col)
        self.lstEnum.SetColumnWidth(0, col_width)
        self.lstEnum.SetColumnWidth(1,col_width)
        self.lstEnum.SetColumnWidth(2, table_width-2*col_width)
        self.lstEnum.SetFont(self.font2)

        self.lstEnum.setResizeColumn(0)
        self.lstEnum.Append(['', '', ''])
        self.lstEnum.SetInitialSize((100, 240))
        self.sizer.Add(self.lstEnum, (3, 0), span=(1, 2), flag=wx.EXPAND | wx.LEFT | wx.BOTTOM, border=10)


        self.btnAdd = wx.Button(self.p1, label='Add')
        self.btnAdd.SetFont(self.font3)
        self.btnAdd.Bind(wx.EVT_BUTTON, self.btnAdd_click)
        self.btnRemove = wx.Button(self.p1, label='Remove')
        self.btnRemove.SetFont(self.font3)
        self.btnRemove.Bind(wx.EVT_BUTTON, self.btnRemove_click)
        self.sizer.Add(self.btnAdd, (4, 0), flag=wx.LEFT | wx.BOTTOM, border=10)
        self.sizer.Add(self.btnRemove, (4, 1))


        line = wx.StaticLine(self.p1)
        self.sizer.Add(line, (5, 0), span=(1, 15), flag=wx.EXPAND)

        toggle_autoplot = buttons.GenToggleButton(self.p1, label='Automatically Plot')
        toggle_autoplot.SetFont(wx.Font(12, wx.MODERN, wx.NORMAL, wx.BOLD, False))
        toggle_autoplot.SetBezelWidth(3)
        toggle_autoplot.SetBackgroundColour('green')

        self.sizer.Add(toggle_autoplot, (6, 0), span=(1, 2), flag=wx.EXPAND | wx.LEFT, border=10)


        #### Customize Y axis

        self.st2 = wx.StaticBox(self.p1, label='Customize Y Axis')
        self.st2.SetFont(self.font2)

        boxsizer = wx.StaticBoxSizer(self.st2, wx.VERTICAL)
        self.cb1 = wx.CheckBox(self.p1, label='Plunge Depth (in)')
        self.cb1.SetFont(self.font3)
        boxsizer.Add(self.cb1, flag=wx.LEFT | wx.BOTTOM| wx.EXPAND, border=5)


        self.cb2 = wx.CheckBox(self.p1, label='Captured Force (lb')
        self.cb2.SetFont(self.font3)
        boxsizer.Add(self.cb2, flag=wx.LEFT | wx.BOTTOM| wx.EXPAND, border=5)

        self.cb3 =  wx.CheckBox(self.p1, label='Plunge Speed (ipm)')
        self.cb3.SetFont(self.font3)
        boxsizer.Add(self.cb3, flag= wx.LEFT | wx.BOTTOM| wx.EXPAND, border=5)

        self.cb4 = wx.CheckBox(self.p1, label='Rotation Speed (rpm)')
        self.cb4.SetFont(self.font3)
        boxsizer.Add(self.cb4, flag=wx.LEFT | wx.BOTTOM| wx.EXPAND, border=5)

        self.cb5 = wx.CheckBox(self.p1, label='Torque ( lb in)')
        self.cb5.SetFont(self.font3)
        boxsizer.Add(self.cb5, flag=wx.LEFT | wx.BOTTOM| wx.EXPAND, border=5)

        # self.Bind(wx.EVT_CHECKBOX, self.OnOneCheck)
        self.sizer.Add(boxsizer, pos=(8, 0), flag=wx.LEFT | wx.BOTTOM| wx.EXPAND, border=5)

        #### PostProcessing

        self.ps = wx.StaticBox(self.p1, label='Post Processing')
        self.ps.SetFont(self.font2)

        boxsizer1 = wx.StaticBoxSizer(self.ps, wx.VERTICAL)
        self.ps1 = wx.CheckBox(self.p1, label='Maximum Captured Force (lb)')
        self.ps1.SetFont(self.font3)
        boxsizer1.Add(self.ps1, flag=wx.LEFT| wx.BOTTOM| wx.EXPAND, border=5)

        self.ps2 = wx.CheckBox(self.p1, label='Force at Maximum Depth (lb)')
        self.ps2.SetFont(self.font3)
        boxsizer1.Add(self.ps2, flag=wx.LEFT| wx.BOTTOM| wx.EXPAND, border=5)

        self.ps3 = wx.CheckBox(self.p1, label='Force of Overshooting (lb)')
        self.ps3.SetFont(self.font3)
        boxsizer1.Add(self.ps3, flag=wx.LEFT| wx.BOTTOM| wx.EXPAND , border=5)

        # self.Bind(wx.EVT_CHECKBOX, self.OnOneCheck)
        self.sizer.Add(boxsizer1, pos=(9, 0), flag=wx.LEFT| wx.BOTTOM| wx.EXPAND, border=5)




        #### Plot Types ####
        hbox2 = wx.BoxSizer(wx.HORIZONTAL)
        self.text_pottype = wx.StaticText(self.p1, label='Plot Types')
        self.text_pottype.SetFont(self.font2)
        hbox2.Add(self.text_pottype, flag=wx.TOP | wx.LEFT | wx.BOTTOM, border=10)

        self.plottype = wx.Choice(self.p1, choices=['Default Plot', 'Customized Plot', 'Post Processing'])
        self.plottype.SetSelection(0)

        # self.default_plot()
        #
        self.Bind(wx.EVT_CHOICE, self.plottype_change)


        self.plottype.SetFont(self.font2)
        hbox2.Add(self.plottype, flag=wx.TOP | wx.LEFT | wx.BOTTOM, border=10)
        self.sizer.Add(hbox2, pos=(7, 0), span=(1, 2), flag=wx.EXPAND | wx.BOTTOM, border=10)
        # self.UpdateFields_2()

        #### Add lines
        st3 = wx.StaticBox(self.p1, label='Add Lines')
        st3.SetFont(self.font2)

        boxsizer = wx.StaticBoxSizer(st3, wx.VERTICAL)
        hbox3 =  wx.BoxSizer(wx.HORIZONTAL)
        self.cb11 = wx.StaticText(self.p1, label='Time (s)')
        self.cb11.SetFont(self.font3)
        hbox3.Add(self.cb11, flag=wx.LEFT | wx.TOP, border=5)
        self.cb11_1 = wx.TextCtrl(self.p1)
        self.cb11_1.SetFont(self.font3)
        hbox3.Add(self.cb11_1, flag=wx.LEFT |wx.TOP, border=5)
        boxsizer.Add(hbox3, wx.LEFT | wx.TOP, border=5)
        boxsizer.SetMinSize(wx.Size(25, 25))

        hbox4 = wx.BoxSizer(wx.HORIZONTAL)
        self.cb12 = wx.StaticText(self.p1, label='Plunge Depth (in)')
        self.cb12.SetFont(self.font3)
        hbox4.Add(self.cb12, flag=wx.LEFT | wx.TOP, border=5)
        self.cb12_1 = wx.TextCtrl(self.p1)
        self.cb12_1.SetFont(self.font3)
        hbox4.Add(self.cb12_1, flag=wx.LEFT |wx.TOP, border=5)
        boxsizer.Add(hbox4, wx.LEFT | wx.TOP, border=5)



        # self.Bind(wx.EVT_CHECKBOX, self.OnOneCheck)
        self.sizer.Add(boxsizer, pos=(10, 0), flag=wx.TOP | wx.LEFT | wx.BOTTOM, border=5)

        run_button = buttons.GenButton(self.p1, label='Run')
        run_button.SetFont(self.font1)
        run_button.SetBezelWidth(3)
        run_button.SetBackgroundColour('green')
        run_button.SetForegroundColour('black')

        self.sizer.Add(run_button, pos=(11, 0), flag= wx.LEFT, border=10)




        self.p1.SetSizer(self.sizer)

        self.UpdateFields()
        self.UpdateFields_2()



    def choType_change(self, e):
        self.UpdateFields()


    def plottype_change(self, e):
        self.UpdateFields_2()
        # self.Maximize()



    def UpdateFields(self):
        isDistr = self.choType.GetSelection() == 0

        self.set_date.Show(isDistr)
        self.input_date.Show(isDistr)
        self.set_ID.Show(isDistr)
        self.input_ID.Show(isDistr)
        self.lstEnum.Show(not isDistr)
        self.btnAdd.Show(not isDistr)
        self.btnRemove.Show(not isDistr)
        self.p1.Layout()

    def UpdateFields_2(self):
        n = self.plottype.GetSelection()
        if n == 0:
            self.st2.Show(False)
            self.cb1.Show(False)
            self.cb2.Show(False)
            self.cb3.Show(False)
            self.cb4.Show(False)
            self.cb5.Show(False)
            self.ps.Show(False)
            self.ps1.Show(False)
            self.ps2.Show(False)
            self.ps3.Show(False)

        elif n == 1:
            self.st2.Show(True)
            self.cb1.Show(True)
            self.cb2.Show(True)
            self.cb3.Show(True)
            self.cb4.Show(True)
            self.cb5.Show(True)
            self.ps.Show(False)
            self.ps1.Show(False)
            self.ps2.Show(False)
            self.ps3.Show(False)

        elif n == 2:
            self.st2.Show(False)
            self.cb1.Show(False)
            self.cb2.Show(False)
            self.cb3.Show(False)
            self.cb4.Show(False)
            self.cb5.Show(False)
            self.ps.Show(True)
            self.ps1.Show(True)
            self.ps2.Show(True)
            self.ps3.Show(True)
        self.p1.Layout()


    def btnAdd_click(self, e):
        self.lstEnum.Append(['', '', ''])
        for i in range(self.lstEnum.GetItemCount() - 1):
            self.lstEnum.Select(i, 0)
        self.lstEnum.Select(self.lstEnum.GetItemCount() - 1)

    def btnRemove_click(self, e):
        item = self.lstEnum.GetFirstSelected()
        while item != -1:
            self.lstEnum.DeleteItem(item)
            item = self.lstEnum.GetFirstSelected()



class EditListCtrl(wx.ListCtrl, wxlc.TextEditMixin,
                               wxlc.ListCtrlAutoWidthMixin):
    def __init__(self, parent, id=-1, pos=wx.DefaultPosition,
                             size=wx.DefaultSize, style=wx.LC_REPORT):
        wx.ListCtrl.__init__(self, parent, id, pos, size, style | wx.LC_REPORT)
        wxlc.TextEditMixin.__init__(self)
        wxlc.ListCtrlAutoWidthMixin.__init__(self)


if __name__ == '__main__':
    app = wx.App()
    frame = BetaFrame(None, 'Beta Version')
    frame.Show()
    app.SetTopWindow(frame)
    app.MainLoop()