def make_linetrace_panel(self, parent, font=None):
        """colours and line properties"""

        panel = scrolled.ScrolledPanel(parent, size=(900, 250),
                                       style=wx.GROW|wx.TAB_TRAVERSAL, name='p1')

        if font is None:
            font = wx.Font(12, wx.SWISS, wx.NORMAL, wx.NORMAL, False)

        sizer = wx.GridBagSizer(2, 2)
        i = 0

        ax = self.axes[0]
        if matplotlib.__version__ < '2.0':
            axis_bgcol = ax.get_axis_bgcolor()
        else:
            axis_bgcol = ax.get_facecolor()

        labstyle= wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL

        opts = dict(size=(40, 30), style=labstyle)

        ctitle = wx.StaticText(panel, -1, ' Colors:  ')
        ltheme = wx.StaticText(panel, -1, ' Color Theme: ')

        themes = list(self.conf.color_themes.keys())

        coltheme = wx.Choice(panel, choices=themes)
        coltheme.SetStringSelection(self.conf.color_theme)
        coltheme.Bind(wx.EVT_CHOICE, self.onColorThemeStyle)

        textcol = csel.ColourSelect(panel, label=" Text ",
                                    colour=mpl_color(self.conf.textcolor),
                                    size=(50, 30), style=labstyle)

        gridcol = csel.ColourSelect(panel, label=" Grid ",
                                    colour=mpl_color(self.conf.gridcolor),
                                    size=(50, 30), style=labstyle)

        bgcol = csel.ColourSelect(panel, label=" Background ",
                                  colour=mpl_color(axis_bgcol),
                                  size=(120, 30), style=labstyle)

        fbgcol = csel.ColourSelect(panel,  label=" Outer Frame ",
                                   colour=mpl_color(self.canvas.figure.get_facecolor()),
                                   size=(120, 30), style=labstyle)


        self.colwids = {'text': textcol, 'bg': bgcol,
                        'grid': gridcol, 'frame': fbgcol}

        bgcol.Bind(csel.EVT_COLOURSELECT,   partial(self.onColor, item='bg'))
        fbgcol.Bind(csel.EVT_COLOURSELECT,  partial(self.onColor, item='frame'))
        gridcol.Bind(csel.EVT_COLOURSELECT, partial(self.onColor, item='grid'))
        textcol.Bind(csel.EVT_COLOURSELECT, partial(self.onColor, item='text'))

        show_grid  = wx.CheckBox(panel,-1, ' Show Grid ', (-1, -1), (-1, -1))
        show_grid.Bind(wx.EVT_CHECKBOX,self.onShowGrid)
        show_grid.SetValue(self.conf.show_grid)

        show_box  = wx.CheckBox(panel,-1, ' Show Top/Right Axes ', (-1, -1), (-1, -1))
        show_box.Bind(wx.EVT_CHECKBOX, self.onShowBox)
        show_box.SetValue(self.conf.axes_style == 'box')

        show_leg = wx.CheckBox(panel,-1, 'Show Legend', (-1, -1), (-1, -1))
        show_leg.Bind(wx.EVT_CHECKBOX,partial(self.onShowLegend, item='legend'))
        show_leg.SetValue(self.conf.show_legend)
        if show_leg not in self.show_legend_cbs:
            self.show_legend_cbs.append(show_leg)

        reset_btn = wx.Button(panel, label='Reset Line Colors', size=(175, -1))
        reset_btn.Bind(wx.EVT_BUTTON, self.onResetLines)

        csizer = wx.BoxSizer(wx.HORIZONTAL)

        csizer.Add(ctitle,    0, labstyle, 3)
        csizer.Add(textcol,   0, labstyle, 3)
        csizer.Add(gridcol,   0, labstyle, 3)
        csizer.Add(bgcol,     0, labstyle, 3)
        csizer.Add(fbgcol ,   0, labstyle, 3)
        csizer.Add(ltheme,    1, labstyle, 3)
        csizer.Add(coltheme,  1, labstyle, 3)
        csizer.Add(reset_btn, 0, labstyle, 3)

        sizer.Add(csizer,    (1, 0), (1, 9), labstyle, 2)


        # csizer.Add(show_grid, 0, labstyle, 3)
        # csizer.Add(show_box,  0, labstyle, 3)
        sizer.Add(show_grid, (2, 1), (1, 1))
        sizer.Add(show_box,  (2, 2), (1, 3))
        sizer.Add(show_leg,  (2, 5), (1, 2))

        irow = 3
        for t in ('#','Label','Color', 'Style',
                  'Thickness','Symbol',' Size', 'Z Order', 'Join Style'):
            x = wx.StaticText(panel, -1, t)
            x.SetFont(font)
            sizer.Add(x,(irow,i),(1,1),wx.ALIGN_LEFT|wx.ALL, 3)
            i = i+1
        self.trace_labels = []
        ntrace_display = min(self.conf.ntrace+2, len(self.conf.traces))
        for i in range(ntrace_display):
            irow += 1
            label  = "trace %i" % i
            lin  = self.conf.traces[i]
            dlab = lin.label
            dcol = hexcolor(lin.color)
            dthk = lin.linewidth
            dmsz = lin.markersize
            dsty = lin.style
            djsty = lin.drawstyle
            dzord = lin.zorder
            dsym = lin.marker
            lab = LabelEntry(panel, dlab, size=125,labeltext="%i" % (i+1),
                               action = partial(self.onText, item='trace', trace=i))
            self.trace_labels.append(lab)

            col = csel.ColourSelect(panel,  -1, "", dcol, size=(25, 25))
            col.Bind(csel.EVT_COLOURSELECT, partial(self.onColor, trace=i))

            self.colwids[i] = col

            thk = FloatSpin(panel, -1,  pos=(-1,-1), size=(FSPINSIZE, 25), value=dthk,
                            min_val=0, max_val=10, increment=0.5, digits=1)
            thk.Bind(EVT_FLOATSPIN, partial(self.onThickness, trace=i))

            sty = wx.Choice(panel, choices=self.conf.styles, size=(100,-1))
            sty.Bind(wx.EVT_CHOICE,partial(self.onStyle,trace=i))
            sty.SetStringSelection(dsty)

            msz = FloatSpin(panel, -1,  pos=(-1,-1), size=(FSPINSIZE, 25), value=dmsz,
                            min_val=0, max_val=30, increment=1, digits=0)
            msz.Bind(EVT_FLOATSPIN, partial(self.onMarkerSize, trace=i))

            zor = FloatSpin(panel, -1,  pos=(-1,-1), size=(FSPINSIZE, 25),
                            value=dzord,
                            min_val=-500, max_val=500, increment=1, digits=0)
            zor.Bind(EVT_FLOATSPIN, partial(self.onZorder, trace=i))

            sym = wx.Choice(panel, -1, choices=self.conf.symbols, size=(120,-1))
            sym.Bind(wx.EVT_CHOICE,partial(self.onSymbol,trace=i))

            sym.SetStringSelection(dsym)

            jsty = wx.Choice(panel, -1, choices=self.conf.drawstyles, size=(100,-1))
            jsty.Bind(wx.EVT_CHOICE, partial(self.onJoinStyle, trace=i))
            jsty.SetStringSelection(djsty)

            sizer.Add(lab.label,(irow,0),(1,1),wx.ALIGN_LEFT|wx.ALL, 5)
            sizer.Add(lab, (irow,1),(1,1),wx.ALIGN_LEFT|wx.ALL, 5)
            sizer.Add(col, (irow,2),(1,1),wx.ALIGN_LEFT|wx.ALL, 5)
            sizer.Add(sty, (irow,3),(1,1),wx.ALIGN_LEFT|wx.ALL, 5)
            sizer.Add(thk, (irow,4),(1,1),wx.ALIGN_LEFT|wx.ALL, 5)
            sizer.Add(sym, (irow,5),(1,1),wx.ALIGN_LEFT|wx.ALL, 5)
            sizer.Add(msz, (irow,6),(1,1),wx.ALIGN_LEFT|wx.ALL, 5)
            sizer.Add(zor, (irow,7),(1,1),wx.ALIGN_LEFT|wx.ALL, 5)
            sizer.Add(jsty, (irow,8),(1,1),wx.ALIGN_LEFT|wx.ALL, 5)

        autopack(panel,sizer)
        panel.SetupScrolling()
        return panel
def make_linetrace_panel ( self , parent , font = None ) : panel = scrolled . ScrolledPanel ( parent , size = ( 900 , 250 ) , style = wx . GROW | wx . TAB_TRAVERSAL , name = 'p1' ) if font is None : font = wx . Font ( 12 , wx . SWISS , wx . NORMAL , wx . NORMAL , False ) sizer = wx . GridBagSizer ( 2 , 2 ) i = 0 ax = self . axes [ 0 ] if matplotlib . __version__ < '2.0' : axis_bgcol = ax . get_axis_bgcolor ( ) else : axis_bgcol = ax . get_facecolor ( ) labstyle = wx . ALIGN_LEFT | wx . ALIGN_CENTER_VERTICAL opts = dict ( size = ( 40 , 30 ) , style = labstyle ) ctitle = wx . StaticText ( panel , - 1 , ' Colors:  ' ) ltheme = wx . StaticText ( panel , - 1 , ' Color Theme: ' ) themes = list ( self . conf . color_themes . keys ( ) ) coltheme = wx . Choice ( panel , choices = themes ) coltheme . SetStringSelection ( self . conf . color_theme ) coltheme . Bind ( wx . EVT_CHOICE , self . onColorThemeStyle ) textcol = csel . ColourSelect ( panel , label = " Text " , colour = mpl_color ( self . conf . textcolor ) , size = ( 50 , 30 ) , style = labstyle ) gridcol = csel . ColourSelect ( panel , label = " Grid " , colour = mpl_color ( self . conf . gridcolor ) , size = ( 50 , 30 ) , style = labstyle ) bgcol = csel . ColourSelect ( panel , label = " Background " , colour = mpl_color ( axis_bgcol ) , size = ( 120 , 30 ) , style = labstyle ) fbgcol = csel . ColourSelect ( panel , label = " Outer Frame " , colour = mpl_color ( self . canvas . figure . get_facecolor ( ) ) , size = ( 120 , 30 ) , style = labstyle ) self . colwids = { 'text' : textcol , 'bg' : bgcol , 'grid' : gridcol , 'frame' : fbgcol } bgcol . Bind ( csel . EVT_COLOURSELECT , partial ( self . onColor , item = 'bg' ) ) fbgcol . Bind ( csel . EVT_COLOURSELECT , partial ( self . onColor , item = 'frame' ) ) gridcol . Bind ( csel . EVT_COLOURSELECT , partial ( self . onColor , item = 'grid' ) ) textcol . Bind ( csel . EVT_COLOURSELECT , partial ( self . onColor , item = 'text' ) ) show_grid = wx . CheckBox ( panel , - 1 , ' Show Grid ' , ( - 1 , - 1 ) , ( - 1 , - 1 ) ) show_grid . Bind ( wx . EVT_CHECKBOX , self . onShowGrid ) show_grid . SetValue ( self . conf . show_grid ) show_box = wx . CheckBox ( panel , - 1 , ' Show Top/Right Axes ' , ( - 1 , - 1 ) , ( - 1 , - 1 ) ) show_box . Bind ( wx . EVT_CHECKBOX , self . onShowBox ) show_box . SetValue ( self . conf . axes_style == 'box' ) show_leg = wx . CheckBox ( panel , - 1 , 'Show Legend' , ( - 1 , - 1 ) , ( - 1 , - 1 ) ) show_leg . Bind ( wx . EVT_CHECKBOX , partial ( self . onShowLegend , item = 'legend' ) ) show_leg . SetValue ( self . conf . show_legend ) if show_leg not in self . show_legend_cbs : self . show_legend_cbs . append ( show_leg ) reset_btn = wx . Button ( panel , label = 'Reset Line Colors' , size = ( 175 , - 1 ) ) reset_btn . Bind ( wx . EVT_BUTTON , self . onResetLines ) csizer = wx . BoxSizer ( wx . HORIZONTAL ) csizer . Add ( ctitle , 0 , labstyle , 3 ) csizer . Add ( textcol , 0 , labstyle , 3 ) csizer . Add ( gridcol , 0 , labstyle , 3 ) csizer . Add ( bgcol , 0 , labstyle , 3 ) csizer . Add ( fbgcol , 0 , labstyle , 3 ) csizer . Add ( ltheme , 1 , labstyle , 3 ) csizer . Add ( coltheme , 1 , labstyle , 3 ) csizer . Add ( reset_btn , 0 , labstyle , 3 ) sizer . Add ( csizer , ( 1 , 0 ) , ( 1 , 9 ) , labstyle , 2 ) sizer . Add ( show_grid , ( 2 , 1 ) , ( 1 , 1 ) ) sizer . Add ( show_box , ( 2 , 2 ) , ( 1 , 3 ) ) sizer . Add ( show_leg , ( 2 , 5 ) , ( 1 , 2 ) ) irow = 3 for t in ( '#' , 'Label' , 'Color' , 'Style' , 'Thickness' , 'Symbol' , ' Size' , 'Z Order' , 'Join Style' ) : x = wx . StaticText ( panel , - 1 , t ) x . SetFont ( font ) sizer . Add ( x , ( irow , i ) , ( 1 , 1 ) , wx . ALIGN_LEFT | wx . ALL , 3 ) i = i + 1 self . trace_labels = [ ] ntrace_display = min ( self . conf . ntrace + 2 , len ( self . conf . traces ) ) for i in range ( ntrace_display ) : irow += 1 label = "trace %i" % i lin = self . conf . traces [ i ] dlab = lin . label dcol = hexcolor ( lin . color ) dthk = lin . linewidth dmsz = lin . markersize dsty = lin . style djsty = lin . drawstyle dzord = lin . zorder dsym = lin . marker lab = LabelEntry ( panel , dlab , size = 125 , labeltext = "%i" % ( i + 1 ) , action = partial ( self . onText , item = 'trace' , trace = i ) ) self . trace_labels . append ( lab ) col = csel . ColourSelect ( panel , - 1 , "" , dcol , size = ( 25 , 25 ) ) col . Bind ( csel . EVT_COLOURSELECT , partial ( self . onColor , trace = i ) ) self . colwids [ i ] = col thk = FloatSpin ( panel , - 1 , pos = ( - 1 , - 1 ) , size = ( FSPINSIZE , 25 ) , value = dthk , min_val = 0 , max_val = 10 , increment = 0.5 , digits = 1 ) thk . Bind ( EVT_FLOATSPIN , partial ( self . onThickness , trace = i ) ) sty = wx . Choice ( panel , choices = self . conf . styles , size = ( 100 , - 1 ) ) sty . Bind ( wx . EVT_CHOICE , partial ( self . onStyle , trace = i ) ) sty . SetStringSelection ( dsty ) msz = FloatSpin ( panel , - 1 , pos = ( - 1 , - 1 ) , size = ( FSPINSIZE , 25 ) , value = dmsz , min_val = 0 , max_val = 30 , increment = 1 , digits = 0 ) msz . Bind ( EVT_FLOATSPIN , partial ( self . onMarkerSize , trace = i ) ) zor = FloatSpin ( panel , - 1 , pos = ( - 1 , - 1 ) , size = ( FSPINSIZE , 25 ) , value = dzord , min_val = - 500 , max_val = 500 , increment = 1 , digits = 0 ) zor . Bind ( EVT_FLOATSPIN , partial ( self . onZorder , trace = i ) ) sym = wx . Choice ( panel , - 1 , choices = self . conf . symbols , size = ( 120 , - 1 ) ) sym . Bind ( wx . EVT_CHOICE , partial ( self . onSymbol , trace = i ) ) sym . SetStringSelection ( dsym ) jsty = wx . Choice ( panel , - 1 , choices = self . conf . drawstyles , size = ( 100 , - 1 ) ) jsty . Bind ( wx . EVT_CHOICE , partial ( self . onJoinStyle , trace = i ) ) jsty . SetStringSelection ( djsty ) sizer . Add ( lab . label , ( irow , 0 ) , ( 1 , 1 ) , wx . ALIGN_LEFT | wx . ALL , 5 ) sizer . Add ( lab , ( irow , 1 ) , ( 1 , 1 ) , wx . ALIGN_LEFT | wx . ALL , 5 ) sizer . Add ( col , ( irow , 2 ) , ( 1 , 1 ) , wx . ALIGN_LEFT | wx . ALL , 5 ) sizer . Add ( sty , ( irow , 3 ) , ( 1 , 1 ) , wx . ALIGN_LEFT | wx . ALL , 5 ) sizer . Add ( thk , ( irow , 4 ) , ( 1 , 1 ) , wx . ALIGN_LEFT | wx . ALL , 5 ) sizer . Add ( sym , ( irow , 5 ) , ( 1 , 1 ) , wx . ALIGN_LEFT | wx . ALL , 5 ) sizer . Add ( msz , ( irow , 6 ) , ( 1 , 1 ) , wx . ALIGN_LEFT | wx . ALL , 5 ) sizer . Add ( zor , ( irow , 7 ) , ( 1 , 1 ) , wx . ALIGN_LEFT | wx . ALL , 5 ) sizer . Add ( jsty , ( irow , 8 ) , ( 1 , 1 ) , wx . ALIGN_LEFT | wx . ALL , 5 ) autopack ( panel , sizer ) panel . SetupScrolling ( ) return panel
colours and line properties