Python wx 模块,GROW 实例源码

我们从Python开源项目中,提取了以下39个代码示例,用于说明如何使用wx.GROW

项目:irida-miseq-uploader    作者:phac-nml    | 项目源码 | 文件源码
def __init__(self, parent, id, title, message, download_url, size=wx.DefaultSize, pos=wx.DefaultPosition, style=wx.DEFAULT_DIALOG_STYLE, name='dialog'):
        wx.Dialog.__init__(self, parent, id, title, pos, size, style, name)

        label = wx.StaticText(self, label=message)
        button = wx.Button(self, id=wx.ID_OK, label="Close")
        button.SetDefault()

        line = wx.StaticLine(self, wx.ID_ANY, size=(20, -1), style=wx.LI_HORIZONTAL)
        download_ctrl = hl.HyperLinkCtrl(self, wx.ID_ANY, download_url, URL=download_url)

        sizer = wx.BoxSizer(wx.VERTICAL)
        button_sizer = wx.StdDialogButtonSizer()
        button_sizer.AddButton(button)
        button_sizer.Realize()

        sizer.Add(label, 0, wx.ALIGN_CENTER|wx.ALL, 5)
        sizer.Add(download_ctrl, 0, wx.ALL, 10)
        sizer.Add(line, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.RIGHT|wx.TOP, 5)
        sizer.Add(button_sizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)

        self.SetSizer(sizer)
        sizer.Fit(self)
项目:dxf2gcode    作者:cnc-club    | 项目源码 | 文件源码
def __init__(self):
        wx.Frame.__init__(self,None,-1,
                         'CanvasFrame',size=(550,350))



        self.SetBackgroundColour(wx.NamedColor("WHITE"))

        self.figure = Figure()
        self.axes = self.figure.add_subplot(111)

        self.canvas = FigureCanvas(self, -1, self.figure)

        self.sizer = wx.BoxSizer(wx.VERTICAL)
        self.sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW)
        self.SetSizer(self.sizer)
        self.Fit()

        self.add_toolbar()  # comment this out for no toolbar

        self.axes.set_title("NURBS and B-Spline Algorithms: ")
项目:pyDataView    作者:edwardsmith999    | 项目源码 | 文件源码
def __init__(self, parent,**kwargs):
        wx.Panel.__init__(self,parent,**kwargs)
        self.parent = parent
        self.figure = matplotlib.figure.Figure()
        self.canvas = wxaggb.FigureCanvasWxAgg(self, -1, self.figure)
        self.sizer = wx.BoxSizer(wx.VERTICAL)
        self.sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW)
        self.Bind(wx.EVT_SIZE, self.sizeHandler)

        # canvas is your canvas, and root is your parent (Frame, TopLevel, Tk instance etc.)
        #self.zoomhandle = wxaggb.NavigationToolbar2WxAgg(self.canvas)

        #self.toolbar = wxb.NavigationToolbar2Wx(self.canvas) 
        #self.toolbar.Realize()
        #self.toolbar.update()

        self.cmap = matplotlib.cm.RdYlBu_r
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
def __init__(self, parent):
        wx.Control.__init__(self, parent)

        main_sizer = wx.FlexGridSizer(cols=2, hgap=0, rows=1, vgap=0)
        main_sizer.AddGrowableCol(0)
        main_sizer.AddGrowableRow(0)

        # create location text control
        self.Duration = wx.TextCtrl(self, size=wx.Size(0, -1),
                                    style=wx.TE_PROCESS_ENTER)
        self.Duration.Bind(wx.EVT_KEY_DOWN, self.OnDurationChar)
        main_sizer.AddWindow(self.Duration, flag=wx.GROW)

        # create browse button
        self.EditButton = wx.Button(self, label='...', size=wx.Size(30, -1))
        self.Bind(wx.EVT_BUTTON, self.OnEditButtonClick, self.EditButton)
        main_sizer.AddWindow(self.EditButton, flag=wx.GROW)

        self.Bind(wx.EVT_SIZE, self.OnSize)

        self.SetSizer(main_sizer)

        self.Default = None
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
def _create_NetworkEditor(self, prnt):
        self.NetworkEditor = wx.Panel(
            id=-1, parent=prnt, pos=wx.Point(0, 0),
            size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)

        NetworkEditorTemplate._init_ctrls(self, self.NetworkEditor)

        main_sizer = wx.FlexGridSizer(cols=1, hgap=0, rows=1, vgap=0)
        main_sizer.AddGrowableCol(0)
        main_sizer.AddGrowableRow(0)

        main_sizer.AddWindow(self.NetworkNodes, 0, border=5, flag=wx.GROW | wx.ALL)

        self.NetworkEditor.SetSizer(main_sizer)

        return self.NetworkEditor
项目:GRIPy    作者:giruenf    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        if 'size' not in kwargs:
            kwargs['size'] = (360, 240)
        super(NewRockTableDialog, self).__init__(*args, **kwargs)
#        ico = wx.Icon(r'./icons/plus32x32.ico', wx.BITMAP_TYPE_ICO)
#        self.SetIcon(ico)
        fgs = wx.BoxSizer(wx.HORIZONTAL)
        main_label = wx.StaticText(self, label="Fill up the cell below to create a new rock table.")
        name_label = wx.StaticText(self, label="Name Rock Table: ")
#        unit_label = wx.StaticText(self, label="Unidade: ")
        self.name_ctrl = wx.TextCtrl(self)
#        self.unit_ctrl = wx.TextCtrl(self)
        fgs.Add(name_label, 0, wx.EXPAND)
        fgs.Add(self.name_ctrl, 1, wx.EXPAND)
#        fgs.AddGrowableRow(0)

        sizer = wx.BoxSizer(wx.VERTICAL)

        button_sizer = self.CreateButtonSizer(wx.OK | wx.CANCEL)

        sizer.Add(main_label, 1, wx.GROW | wx.EXPAND)
        sizer.Add(fgs, 0, wx.EXPAND)
        sizer.Add(button_sizer, 0, wx.EXPAND)
        self.SetSizer(sizer)
        self.name_ctrl.SetFocus()
项目:IntroPython2016a    作者:UWPCE-PythonCert    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        wx.Panel.__init__(self, *args, **kwargs)

        ## add two buttons:
        theButton1 = wx.Button(self, label="Push Me")
        theButton1.Bind(wx.EVT_BUTTON, self.onButton)

        ## add two buttons:
        theButton2 = wx.Button(self, label="Push Me Also")
        theButton2.Bind(wx.EVT_BUTTON, self.onButton)

        ## do the layout
        ## (try uncommenting the other, and see what happens...)
        #S = wx.BoxSizer(wx.VERTICAL)
        S = wx.BoxSizer(wx.HORIZONTAL)

        S.Add(theButton1, 0, wx.GROW | wx.ALL, 4)
        S.Add(theButton2, 0, wx.GROW | wx.ALL, 4)

        self.SetSizerAndFit(S)
项目:PandasDataFrameGUI    作者:bluenote10    | 项目源码 | 文件源码
def __init__(self, parent, df, status_bar_callback):
        wx.Panel.__init__(self, parent)

        self.df_list_ctrl = ListCtrlDataFrame(self, df, status_bar_callback)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.df_list_ctrl, 1, wx.ALL | wx.EXPAND | wx.GROW, 5)
        self.SetSizer(sizer)
        self.Show()
项目:PandasDataFrameGUI    作者:bluenote10    | 项目源码 | 文件源码
def __init__(self, parent, columns, df_list_ctrl):
        wx.Panel.__init__(self, parent)

        self.columns = columns
        self.df_list_ctrl = df_list_ctrl

        self.list_box = ListBoxDraggable(self, -1, columns, style=wx.LB_EXTENDED)
        self.Bind(wx.EVT_LISTBOX, self.update_selected_columns)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.list_box, 1, wx.ALL | wx.EXPAND | wx.GROW, 5)
        self.SetSizer(sizer)
        self.list_box.SetFocus()
项目:bonsu    作者:bonsudev    | 项目源码 | 文件源码
def __init__(self, parent):
        wx.Panel.__init__(self, parent)
        self.ancestor = parent
        self.fontpointsize=wx.SystemSettings.GetFont(wx.SYS_SYSTEM_FONT).GetPointSize()
        self.colour = wx.Colour(30,70,115, alpha=wx.ALPHA_OPAQUE)
        self.canvas = PlotCanvas(self)
        if IsNotWX4():
            self.canvas.SetInitialSize(size=self.GetClientSize())
            self.canvas.SetShowScrollbars(True)
            self.canvas.SetEnableZoom(False)
            self.canvas.SetFontSizeAxis(point=12)
            self.canvas.SetFontSizeTitle(point=12)
            self.canvas.SetGridColour(wx.Colour(0, 0, 0))
            self.canvas.SetForegroundColour(wx.Colour(0, 0, 0))
            self.canvas.SetBackgroundColour(wx.Colour(255, 255, 255))
        else:
            self.canvas.axesPen = wx.Pen(self.colour, width=1, style=wx.PENSTYLE_SOLID)
            self.canvas.SetForegroundColour(wx.Colour(0, 0, 0))
            self.canvas.SetBackgroundColour(wx.Colour(255, 255, 255))
            self.canvas.enableGrid = (True,True)
            self.canvas.fontSizeAxis = self.fontpointsize
            self.canvas.fontSizeTitle = self.fontpointsize
        self.vbox = wx.BoxSizer(wx.VERTICAL)
        self.vbox.Add(self.canvas, 1, flag=wx.LEFT | wx.TOP | wx.GROW)
        self.paused = False
        self.hbox_btn = wx.BoxSizer(wx.HORIZONTAL)
        self.hbox_btn.AddSpacer(20)
        self.button_pause =wx.Button(self, label="Pause Graph")
        self.Bind(wx.EVT_BUTTON, self.OnClickPauseButton, self.button_pause)
        self.hbox_btn.Add(self.button_pause)
        self.button_save =wx.Button(self, label="Save Data")
        self.Bind(wx.EVT_BUTTON, self.OnClickSaveButton, self.button_save)
        self.hbox_btn.Add(self.button_save)
        self.vbox.Add(self.hbox_btn, 0, wx.EXPAND)
        self.SetSizer(self.vbox)
        self.Fit()
        self.Show()
        self.data_poll_timer = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.UpdateGraph, self.data_poll_timer)
项目:pyDataView    作者:edwardsmith999    | 项目源码 | 文件源码
def __init__(self, parent, title):
        wx.Frame.__init__(self, parent, -1, title, size=(550, 350))
        self.SetBackgroundColour(wx.NamedColour("WHITE"))

        self.figure = Figure()
        self.axes = self.figure.add_subplot(111)
        self.change_plot(0)

        self.canvas = FigureCanvas(self, -1, self.figure)

        self.sizer = wx.BoxSizer(wx.VERTICAL)
        self.add_buttonbar()
        self.sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW)
        self.add_toolbar()  # comment this out for no toolbar

        menuBar = wx.MenuBar()

        # File Menu
        menu = wx.Menu()
        menu.Append(wx.ID_EXIT, "E&xit\tAlt-X", "Exit this simple sample")
        menuBar.Append(menu, "&File")

        if IS_GTK or IS_WIN:
            # Equation Menu
            menu = wx.Menu()
            for i, (mt, func) in enumerate(functions):
                bm = mathtext_to_wxbitmap(mt)
                item = wx.MenuItem(menu, 1000 + i, "")
                item.SetBitmap(bm)
                menu.AppendItem(item)
                self.Bind(wx.EVT_MENU, self.OnChangePlot, item)
            menuBar.Append(menu, "&Functions")

        self.SetMenuBar(menuBar)

        self.SetSizer(self.sizer)
        self.Fit()
项目:pyDataView    作者:edwardsmith999    | 项目源码 | 文件源码
def add_buttonbar(self):
        self.button_bar = wx.Panel(self)
        self.button_bar_sizer = wx.BoxSizer(wx.HORIZONTAL)
        self.sizer.Add(self.button_bar, 0, wx.LEFT | wx.TOP | wx.GROW)

        for i, (mt, func) in enumerate(functions):
            bm = mathtext_to_wxbitmap(mt)
            button = wx.BitmapButton(self.button_bar, 1000 + i, bm)
            self.button_bar_sizer.Add(button, 1, wx.GROW)
            self.Bind(wx.EVT_BUTTON, self.OnChangePlot, button)

        self.button_bar.SetSizer(self.button_bar_sizer)
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
def __init__(self, parent, name, library, default=None):
        wx.Dialog.__init__(self,
                           name='BrowseValueDialog', parent=parent,
                           style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER,
                           title=_('Browse %s values library') % name)

        self.staticText1 = wx.StaticText(
              label=_('Choose a value for %s:') % name, name='staticText1', parent=self,
              pos=wx.Point(0, 0), size=wx.DefaultSize, style=0)

        self.ValuesLibrary = wx.TreeCtrl(
              name='ValuesLibrary', parent=self, pos=wx.Point(0, 0),
              size=wx.Size(400, 200), style=wx.TR_HAS_BUTTONS | wx.TR_SINGLE | wx.SUNKEN_BORDER | wx.TR_HIDE_ROOT | wx.TR_LINES_AT_ROOT)

        self.ButtonSizer = self.CreateButtonSizer(wx.OK | wx.CANCEL | wx.CENTRE)

        self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetAffirmativeButton().GetId())

        self.flexGridSizer1 = wx.FlexGridSizer(cols=1, hgap=0, rows=3, vgap=10)

        self.flexGridSizer1.AddWindow(self.staticText1,   0, border=20, flag=wx.GROW | wx.TOP | wx.LEFT | wx.RIGHT)
        self.flexGridSizer1.AddWindow(self.ValuesLibrary, 0, border=20, flag=wx.GROW | wx.LEFT | wx.RIGHT)
        self.flexGridSizer1.AddSizer(self.ButtonSizer,    0, border=20, flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT)

        self.flexGridSizer1.AddGrowableCol(0)
        self.flexGridSizer1.AddGrowableRow(1)

        self.SetSizer(self.flexGridSizer1)
        self.Fit()

        root = self.ValuesLibrary.AddRoot("")
        self.GenerateValuesLibraryBranch(root, library, default)
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
def _init_coll_MainSizer_Items(self, parent):
        parent.AddWindow(self.staticText1,    0, border=20, flag=wx.TOP | wx.LEFT | wx.RIGHT | wx.GROW)
        parent.AddWindow(self.ServicesList,   0, border=20, flag=wx.LEFT | wx.RIGHT | wx.GROW)
        parent.AddSizer(self.ButtonGridSizer, 0, border=20, flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.GROW)
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
def __init__(self, parent):
        wx.Dialog.__init__(self, parent, title=_('Create a new action'))

        main_sizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=10)
        main_sizer.AddGrowableCol(0)
        main_sizer.AddGrowableRow(0)

        infos_sizer = wx.FlexGridSizer(cols=2, hgap=5, rows=3, vgap=15)
        infos_sizer.AddGrowableCol(1)
        main_sizer.AddSizer(infos_sizer, border=20,
                            flag=wx.GROW | wx.TOP | wx.LEFT | wx.RIGHT)

        actionname_label = wx.StaticText(self, label=_('Action Name:'))
        infos_sizer.AddWindow(actionname_label, border=4,
                              flag=wx.ALIGN_CENTER_VERTICAL | wx.TOP)

        self.ActionName = wx.TextCtrl(self, size=wx.Size(180, -1))
        infos_sizer.AddWindow(self.ActionName, flag=wx.GROW)

        language_label = wx.StaticText(self, label=_('Language:'))
        infos_sizer.AddWindow(language_label, border=4,
                              flag=wx.ALIGN_CENTER_VERTICAL | wx.TOP)

        self.Language = wx.ComboBox(self, style=wx.CB_READONLY)
        infos_sizer.AddWindow(self.Language, flag=wx.GROW)

        button_sizer = self.CreateButtonSizer(wx.OK | wx.CANCEL | wx.CENTRE)
        self.Bind(wx.EVT_BUTTON, self.OnOK,
                  button_sizer.GetAffirmativeButton())
        main_sizer.AddSizer(button_sizer, border=20,
                            flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT)

        self.SetSizer(main_sizer)

        for option in GetActionLanguages():
            self.Language.Append(_(option))

        self.Fit()
        self.PouNames = []
        self.PouElementNames = []
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
def __init__(self, parent):
        wx.Dialog.__init__(self, parent, title=_('Create a new transition'))

        main_sizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=10)
        main_sizer.AddGrowableCol(0)
        main_sizer.AddGrowableRow(0)

        infos_sizer = wx.FlexGridSizer(cols=2, hgap=5, rows=3, vgap=10)
        infos_sizer.AddGrowableCol(1)
        main_sizer.AddSizer(infos_sizer, border=20,
                            flag=wx.GROW | wx.TOP | wx.LEFT | wx.RIGHT)

        transitionname_label = wx.StaticText(self, label=_('Transition Name:'))
        infos_sizer.AddWindow(transitionname_label, border=4,
                              flag=wx.ALIGN_CENTER_VERTICAL | wx.TOP)

        self.TransitionName = wx.TextCtrl(self, size=wx.Size(180, -1))
        infos_sizer.AddWindow(self.TransitionName, flag=wx.GROW)

        language_label = wx.StaticText(self, label=_('Language:'))
        infos_sizer.AddWindow(language_label, border=4,
                              flag=wx.ALIGN_CENTER_VERTICAL | wx.TOP)

        self.Language = wx.ComboBox(self, style=wx.CB_READONLY)
        infos_sizer.AddWindow(self.Language, flag=wx.GROW)

        button_sizer = self.CreateButtonSizer(wx.OK | wx.CANCEL | wx.CENTRE)
        self.Bind(wx.EVT_BUTTON, self.OnOK, button_sizer.GetAffirmativeButton())
        main_sizer.AddSizer(button_sizer, border=20, flag=wx.ALIGN_RIGHT | wx.BOTTOM)

        self.SetSizer(main_sizer)

        for language in GetTransitionLanguages():
            self.Language.Append(_(language))

        self.Fit()
        self.PouNames = []
        self.PouElementNames = []
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
def __init__(self, parent):
        wx.Dialog.__init__(self, parent, title=_('Edit Duration'))

        main_sizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=10)
        main_sizer.AddGrowableCol(0)
        main_sizer.AddGrowableRow(0)

        controls_sizer = wx.FlexGridSizer(cols=len(CONTROLS), hgap=10, rows=2, vgap=10)
        main_sizer.AddSizer(controls_sizer, border=20,
                            flag=wx.TOP | wx.LEFT | wx.RIGHT | wx.GROW)

        controls = []
        for i, (name, label) in enumerate(CONTROLS):
            controls_sizer.AddGrowableCol(i)

            st = wx.StaticText(self, label=label)
            txtctrl = wx.TextCtrl(self, value='0', style=wx.TE_PROCESS_ENTER)
            self.Bind(wx.EVT_TEXT_ENTER,
                      self.GetControlValueTestFunction(txtctrl),
                      txtctrl)
            setattr(self, name, txtctrl)

            controls.append((st, txtctrl))

        for st, txtctrl in controls:
            controls_sizer.AddWindow(st, flag=wx.GROW)

        for st, txtctrl in controls:
            controls_sizer.AddWindow(txtctrl, flag=wx.GROW)

        button_sizer = self.CreateButtonSizer(wx.OK | wx.CANCEL | wx.CENTRE)
        self.Bind(wx.EVT_BUTTON, self.OnOK, button_sizer.GetAffirmativeButton())
        main_sizer.AddSizer(button_sizer, border=20,
                            flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT)

        self.SetSizer(main_sizer)
        self.Fit()
        self.Days.SetFocus()
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
def _init_coll_MainSizer_Items(self, parent):
        parent.AddSizer(self.HeaderSizer, 0, border=0, flag=wx.GROW)
        parent.AddWindow(self.SearchResultsTree, 1, border=0, flag=wx.GROW)
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
def AddSizerParams(self, parent, sizer, params):
        for idx, (name, label) in enumerate(params):
            border = 0
            if idx == 0:
                border |= wx.TOP
            elif idx == len(params) - 1:
                border |= wx.BOTTOM

            st = wx.StaticText(parent, label=label)
            sizer.AddWindow(st, border=10,
                            flag=wx.ALIGN_CENTER_VERTICAL | border | wx.LEFT)

            tc = wx.TextCtrl(parent, style=wx.TE_PROCESS_ENTER)
            setattr(self, name, tc)
            callback = self.GetTextCtrlChangedFunction(tc, name)
            self.Bind(wx.EVT_TEXT_ENTER, callback, tc)
            tc.Bind(wx.EVT_KILL_FOCUS, callback)
            sizer.AddWindow(tc, border=10,
                            flag=wx.GROW | border | wx.RIGHT)
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
def RefreshGraphicsSizer(self):
        self.GraphicsSizer.Clear()

        for panel in self.GraphicPanels:
            self.GraphicsSizer.AddWindow(panel, flag=wx.GROW)

        self.GraphicsSizer.Layout()
        self.RefreshGraphicsWindowScrollbars()
项目:cx_Freeze    作者:anthony-tuininga    | 项目源码 | 文件源码
def __init__(self):
        wx.Frame.__init__(self, None, -1, 'CanvasFrame', size=(550, 350))
        color = wx.Colour("WHITE")
        self.SetBackgroundColour(color)
        self.figure = Figure()
        self.axes = self.figure.add_subplot(111)
        t = arange(0.0, 3.0, 0.01)
        s = sin(2 * pi * t)
        self.axes.plot(t, s)
        self.canvas = FigureCanvas(self, -1, self.figure)
        self.sizer = wx.BoxSizer(wx.VERTICAL)
        self.sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW)
        self.SetSizerAndFit(self.sizer)
        self.add_toolbar()
项目:wxpythoncookbookcode    作者:driscollis    | 项目源码 | 文件源码
def __init__(self, title='Snapshot Printer'):
        wx.Frame.__init__(self, None, title=title, 
                          size=(650,400))

        self.panel = wx.Panel(self)
        self.printer = HtmlEasyPrinting(
            name='Printing', parentWindow=None)

        self.html = HtmlWindow(self.panel)
        self.html.SetRelatedFrame(self, self.GetTitle())

        if not os.path.exists('screenshot.htm'):
            self.createHtml()
        self.html.LoadPage('screenshot.htm')

        pageSetupBtn = wx.Button(self.panel, label='Page Setup')
        printBtn = wx.Button(self.panel, label='Print')
        cancelBtn = wx.Button(self.panel, label='Cancel')

        self.Bind(wx.EVT_BUTTON, self.onSetup, pageSetupBtn)
        self.Bind(wx.EVT_BUTTON, self.onPrint, printBtn)
        self.Bind(wx.EVT_BUTTON, self.onCancel, cancelBtn)

        sizer = wx.BoxSizer(wx.VERTICAL)
        btnSizer = wx.BoxSizer(wx.HORIZONTAL)

        sizer.Add(self.html, 1, wx.GROW)
        btnSizer.Add(pageSetupBtn, 0, wx.ALL, 5)
        btnSizer.Add(printBtn, 0, wx.ALL, 5)
        btnSizer.Add(cancelBtn, 0, wx.ALL, 5)
        sizer.Add(btnSizer)

        self.panel.SetSizer(sizer)
        self.panel.SetAutoLayout(True)
项目:GRIPy    作者:giruenf    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        if 'size' not in kwargs:
            kwargs['size'] = (360, 240)
        super(NewPartitionDialog, self).__init__(*args, **kwargs)
#        ico = wx.Icon(r'./icons/plus32x32.ico', wx.BITMAP_TYPE_ICO)
#        self.SetIcon(ico)
        fgs = wx.BoxSizer(wx.HORIZONTAL)
        main_label = wx.StaticText(self, label="Fill up the cell below to create a new partition.")
        name_label = wx.StaticText(self, label="Name Partition: ")
#        unit_label = wx.StaticText(self, label="Unidade: ")
        self.name_ctrl = wx.TextCtrl(self)
#        self.unit_ctrl = wx.TextCtrl(self)
        fgs.Add(name_label, 0, wx.EXPAND)
        fgs.Add(self.name_ctrl, 1, wx.EXPAND)
#        fgs.AddGrowableRow(0)

        sizer = wx.BoxSizer(wx.VERTICAL)

        button_sizer = self.CreateButtonSizer(wx.OK | wx.CANCEL)

        #if _iswxphoenix:
        sizer.Add(main_label, 1, wx.GROW | wx.EXPAND)
        sizer.Add(fgs, 0, wx.EXPAND)
        sizer.Add(button_sizer, 0, wx.EXPAND)
        #else:
        #    sizer.AddSizer(fgs, proportion=1, flag=wx.EXPAND)
        #    sizer.AddSizer(button_sizer, proportion=0, flag=wx.EXPAND)
#        self.
        self.SetSizer(sizer)
        self.name_ctrl.SetFocus()
项目:PAWS    作者:Moonbase59    | 项目源码 | 文件源码
def _init_coll_flexGridSizer1_Items(self, parent):
        # generated method, don't edit

        parent.AddWindow(self.TDisplay, 0, border=0, flag=wx.GROW | wx.EXPAND)
        parent.AddWindow(self.TInput, 1, border=1,
              flag=wx.GROW | wx.RIGHT | wx.LEFT | wx.EXPAND | wx.ALIGN_BOTTOM)
项目:IntroPython2016a    作者:UWPCE-PythonCert    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        kwargs.setdefault('title', "Calculator")
        wx.Frame.__init__(self, *args, **kwargs)

        self.calcPanel = Calculator(self)

        # put the panel on -- in a sizer to give it some space
        S = wx.BoxSizer(wx.VERTICAL)
        S.Add(self.calcPanel, 1, wx.GROW|wx.ALL, 10)
        self.SetSizerAndFit(S)
        self.CenterOnScreen()
项目:IntroPython2016a    作者:UWPCE-PythonCert    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        wx.Panel.__init__(self, *args, **kwargs)

        ## add a button:
        theButton1 = wx.Button(self, label="Push Me")
        theButton1.Bind(wx.EVT_BUTTON, self.onButton)

        ## add another button:
        theButton2 = wx.Button(self, label="Push Me Also")
        theButton2.Bind(wx.EVT_BUTTON, self.onButton)

        ## do the layout
        buttonSizer = wx.BoxSizer(wx.VERTICAL)

        buttonSizer.Add((1,1), 1)    # stretchable space
        buttonSizer.Add(theButton1, 0, wx.GROW | wx.ALL, 4)
        buttonSizer.Add(theButton2, 0, wx.GROW | wx.ALL, 4)
        buttonSizer.Add((1,1), 3)    # stretchable space

        ## need another sizer to get the horizonal placement right:
        mainSizer = wx.BoxSizer(wx.HORIZONTAL)
        mainSizer.Add((1,1), 1)    # stretchable space
        mainSizer.Add(buttonSizer, 0, wx.GROW) # the sizer with the buttons in it
        mainSizer.Add((1,1), 1)    # stretchable space

        self.SetSizer(mainSizer)
项目:IntroPython2016a    作者:UWPCE-PythonCert    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        wx.Panel.__init__(self, *args, **kwargs)

        ## add a button:
        theButton1 = wx.Button(self, label="Push Me")
        theButton1.Bind(wx.EVT_BUTTON, self.onButton)

        ## add a static text lable:
        label1 = wx.StaticText(self, label="Input Box:")

        ## add a text control:
        self.inTextControl = wx.TextCtrl(self)

        ## add another button:
        theButton2 = wx.Button(self, label="GetData")
        theButton2.Bind(wx.EVT_BUTTON, self.onGetData)

        ## add a static text lable:
        label2 = wx.StaticText(self, label="Output Box:")
        ## and another text control:
        self.outTextControl = wx.TextCtrl(self, style=wx.TE_READONLY)


        ## do the layout
        buttonSizer = wx.BoxSizer(wx.VERTICAL)

        buttonSizer.Add(theButton1, 0, wx.GROW | wx.ALL, 4)
        buttonSizer.Add(label1, 0, wx.ALIGN_LEFT | wx.TOP, 4)
        buttonSizer.Add(self.inTextControl, 0, wx.GROW | wx.ALL, 4)
        buttonSizer.Add((150, 10))
        buttonSizer.Add(theButton2, 0, wx.GROW | wx.ALL, 4)
        buttonSizer.Add(label2, 0, wx.ALIGN_LEFT | wx.TOP, 4)
        buttonSizer.Add(self.outTextControl, 0, wx.GROW | wx.ALL, 4)

        ## need another sizer to get the horizonal placement right:
        mainSizer = wx.BoxSizer(wx.HORIZONTAL)
        mainSizer.Add((1,1), 1)    # stretchable space
        mainSizer.Add(buttonSizer, 0, wx.ALIGN_TOP) # the sizer with the buttons in it
        mainSizer.Add((1,1), 1)    # stretchable space

        self.SetSizer(mainSizer)
项目:SameKeyProxy    作者:xzhou    | 项目源码 | 文件源码
def _build(self):
      """
      Building widgets and setting static widget data.      
      """
      parent = wx.Panel(self, -1)
      sizer0 = wx.BoxSizer(wx.VERTICAL)
      sizer0.Add(self._buildTopBar(parent), 0, wx.ALIGN_LEFT|wx.GROW, 5)

      splitter = wx.SplitterWindow(parent, -1)
      #- TOP PART --------------------------------------------------------#
      topParent = wx.Panel(splitter, -1)
      topSizer = wx.BoxSizer(wx.VERTICAL)
      self.treeCtrlItems = wx.TreeCtrl(topParent, -1,
                         style = wx.TR_TWIST_BUTTONS|wx.TR_LINES_AT_ROOT|wx.TR_HAS_BUTTONS|wx.TR_HIDE_ROOT|wx.TR_MULTIPLE)
      topSizer.Add(self.treeCtrlItems, 1, wx.EXPAND, 5)
      topParent.SetAutoLayout( True )
      topParent.SetSizer(topSizer )
      topSizer.Fit(topParent)
      topSizer.SetSizeHints(topParent)
      #-------------------------------------------------------------------#
      #- BOTTOM PART -----------------------------------------------------#
      bottomParent = wx.Panel(splitter,-1)
      bottomSizer = wx.BoxSizer(wx.VERTICAL)
      self.txtCtrlLog=wx_StdoutLog(bottomParent, -1, "",
                                  size= wx.Size(-1, 10),
                                  style=wx.TE_MULTILINE|wx.TE_READONLY|wx.TE_RICH)
      bottomSizer.Add(self.txtCtrlLog, 1, wx.EXPAND, 5)
      bottomParent.SetAutoLayout( True )
      bottomParent.SetSizer(bottomSizer )
      bottomSizer.Fit(bottomParent)
      bottomSizer.SetSizeHints(bottomParent)
      #-------------------------------------------------------------------#
      splitter.SplitHorizontally(topParent,bottomParent, -100)
      sizer0.Add(splitter, 1, wx.EXPAND|wx.ALIGN_CENTRE, 5)

      self.buttonClose = wx.Button(parent, -1, 'Close')         # buttonClose
      sizer0.Add(self.buttonClose, 0, wx.ALIGN_CENTRE|wx.ALL, 5)

      parent.SetAutoLayout( True )
      parent.SetSizer( sizer0 )
      sizer0.Fit( parent)
      sizer0.SetSizeHints( parent)
项目:tindieorderprintout    作者:limpkin    | 项目源码 | 文件源码
def __init__(
            self, parent, ID, title, size=wx.DefaultSize, pos=wx.DefaultPosition, 
            style=wx.DEFAULT_DIALOG_STYLE, fields=None, data=None,
            ):

        wx.Dialog.__init__ (self, parent, ID, title, pos, size, style)

        sizer = wx.BoxSizer(wx.VERTICAL)

        self.textctrls = {}
        for field in fields:
            box = wx.BoxSizer(wx.HORIZONTAL)
            label = wx.StaticText(self, -1, field)
            label.SetHelpText("This is the help text for the label")
            box.Add(label, 1, wx.ALIGN_CENTRE|wx.ALL, 5)
            text = wx.TextCtrl(self, -1, "", size=(80,-1))
            text.SetHelpText("Here's some help text for field #1")
            if field in data:
                text.SetValue(repr(data[field]))
            box.Add(text, 1, wx.ALIGN_CENTRE|wx.ALL, 1)
            sizer.Add(box, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 1)
            self.textctrls[field] = text

        line = wx.StaticLine(self, -1, size=(20,-1), style=wx.LI_HORIZONTAL)
        sizer.Add(line, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.RIGHT|wx.TOP, 5)

        btnsizer = wx.StdDialogButtonSizer()

        btn = wx.Button(self, wx.ID_OK)
        btn.SetHelpText("The OK button completes the dialog")
        btn.SetDefault()
        btnsizer.AddButton(btn)

        btn = wx.Button(self, wx.ID_CANCEL)
        btn.SetHelpText("The Cancel button cancels the dialog. (Cool, huh?)")
        btnsizer.AddButton(btn)
        btnsizer.Realize()

        sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)

        self.SetSizer(sizer)
        sizer.Fit(self)
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
def __init__(self, parent, controller, tagname, initial=False):
        """
        Constructor
        @param parent: Parent wx.Window of dialog for modal
        @param controller: Reference to project controller
        @param tagname: Tagname of project POU edited
        @param initial: True if step is initial (default: False)
        """
        BlockPreviewDialog.__init__(self, parent, controller, tagname,
                                    title=_('Edit Step'))

        # Init common sizers
        self._init_sizers(2, 0, 6, None, 2, 1)

        # Create label for SFC step name
        name_label = wx.StaticText(self, label=_('Name:'))
        self.LeftGridSizer.AddWindow(name_label, flag=wx.GROW)

        # Create text control for defining SFC step name
        self.StepName = wx.TextCtrl(self)
        self.Bind(wx.EVT_TEXT, self.OnNameChanged, self.StepName)
        self.LeftGridSizer.AddWindow(self.StepName, flag=wx.GROW)

        # Create label for SFC step connectors
        connectors_label = wx.StaticText(self, label=_('Connectors:'))
        self.LeftGridSizer.AddWindow(connectors_label, flag=wx.GROW)

        # Create check boxes for defining connectors available on SFC step
        self.ConnectorsCheckBox = {}
        for name, label in [("input", _("Input")),
                            ("output", _("Output")),
                            ("action", _("Action"))]:
            check_box = wx.CheckBox(self, label=label)
            if name == "output" or (name == "input" and not initial):
                check_box.SetValue(True)
            self.Bind(wx.EVT_CHECKBOX, self.OnConnectorsChanged, check_box)
            self.LeftGridSizer.AddWindow(check_box, flag=wx.GROW)
            self.ConnectorsCheckBox[name] = check_box

        # Add preview panel and associated label to sizers
        self.RightGridSizer.AddWindow(self.PreviewLabel, flag=wx.GROW)
        self.RightGridSizer.AddWindow(self.Preview, flag=wx.GROW)

        # Add buttons sizer to sizers
        self.MainSizer.AddSizer(
            self.ButtonSizer, border=20,
            flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT)

        # Save flag that indicates that step is initial
        self.Initial = initial

        # Set default name for step
        self.StepName.ChangeValue(controller.GenerateNewName(
               tagname, None, "Step%d", 0))

        self.Fit()

        # Step name text control is default control having keyboard focus
        self.StepName.SetFocus()
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
def __init__(self, parent, controller, tagname):
        """
        Constructor
        @param parent: Parent wx.Window of dialog for modal
        @param controller: Reference to project controller
        @param tagname: Tagname of project POU edited
        """
        BlockPreviewDialog.__init__(self, parent, controller, tagname,
                                    title=_('Power Rail Properties'))

        # Init common sizers
        self._init_sizers(2, 0, 5, None, 2, 1)

        # Create label for connection type
        type_label = wx.StaticText(self, label=_('Type:'))
        self.LeftGridSizer.AddWindow(type_label, flag=wx.GROW)

        # Create radio buttons for selecting power rail type
        self.TypeRadioButtons = {}
        first = True
        for type, label in [(LEFTRAIL, _('Left PowerRail')),
                            (RIGHTRAIL, _('Right PowerRail'))]:
            radio_button = wx.RadioButton(self, label=label,
                                          style=(wx.RB_GROUP if first else 0))
            radio_button.SetValue(first)
            self.Bind(wx.EVT_RADIOBUTTON, self.OnTypeChanged, radio_button)
            self.LeftGridSizer.AddWindow(radio_button, flag=wx.GROW)
            self.TypeRadioButtons[type] = radio_button
            first = False

        # Create label for power rail pin number
        pin_number_label = wx.StaticText(self, label=_('Pin number:'))
        self.LeftGridSizer.AddWindow(pin_number_label, flag=wx.GROW)

        # Create spin control for defining power rail pin number
        self.PinNumber = wx.SpinCtrl(self, min=1, max=50,
                                     style=wx.SP_ARROW_KEYS)
        self.PinNumber.SetValue(1)
        self.Bind(wx.EVT_SPINCTRL, self.OnPinNumberChanged, self.PinNumber)
        self.LeftGridSizer.AddWindow(self.PinNumber, flag=wx.GROW)

        # Add preview panel and associated label to sizers
        self.RightGridSizer.AddWindow(self.PreviewLabel, flag=wx.GROW)
        self.RightGridSizer.AddWindow(self.Preview, flag=wx.GROW)

        # Add buttons sizer to sizers
        self.MainSizer.AddSizer(
            self.ButtonSizer, border=20,
            flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT)
        self.Fit()

        # Left Power Rail radio button is default control having keyboard focus
        self.TypeRadioButtons[LEFTRAIL].SetFocus()
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
def __init__(self, parent, datatypes, infos):
        wx.Dialog.__init__(self, parent, title=_('Edit array type properties'))

        main_sizer = wx.FlexGridSizer(cols=1, hgap=0, rows=3, vgap=10)
        main_sizer.AddGrowableCol(0)
        main_sizer.AddGrowableRow(1)

        top_sizer = wx.BoxSizer(wx.HORIZONTAL)
        main_sizer.AddSizer(top_sizer, border=20,
                            flag=wx.GROW | wx.TOP | wx.LEFT | wx.RIGHT)

        basetype_label = wx.StaticText(self, label=_('Base Type:'))
        top_sizer.AddWindow(basetype_label, 1, flag=wx.ALIGN_BOTTOM)

        self.BaseType = wx.ComboBox(self, style=wx.CB_READONLY)
        top_sizer.AddWindow(self.BaseType, 1, flag=wx.GROW)

        self.Dimensions = CustomEditableListBox(self, label=_("Dimensions:"),
                                                style=(wx.gizmos.EL_ALLOW_NEW |
                                                       wx.gizmos.EL_ALLOW_EDIT |
                                                       wx.gizmos.EL_ALLOW_DELETE))
        for func in ["_OnLabelEndEdit",
                     "_OnAddButton",
                     "_OnDelButton",
                     "_OnUpButton",
                     "_OnDownButton"]:
            setattr(self.Dimensions, func, self.OnDimensionsChanged)
        main_sizer.AddSizer(self.Dimensions, border=20,
                            flag=wx.GROW | wx.LEFT | wx.RIGHT)

        button_sizer = self.CreateButtonSizer(wx.OK | wx.CANCEL | wx.CENTRE)
        self.Bind(wx.EVT_BUTTON, self.OnOK, button_sizer.GetAffirmativeButton())
        main_sizer.AddSizer(button_sizer, border=20,
                            flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT)

        self.SetSizer(main_sizer)

        for datatype in datatypes:
            self.BaseType.Append(datatype)

        if isinstance(infos, TupleType) and infos[0] == "array":
            self.BaseType.SetStringSelection(infos[1])
            self.Dimensions.SetStrings(map(lambda x: "..".join(x), infos[2]))
        elif infos in datatypes:
            self.BaseType.SetStringSelection(infos)

        self.BaseType.SetFocus()
        self.Fit()
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
def _init_sizers(self,
                     main_rows, main_growable_row,
                     left_rows, left_growable_row,
                     right_rows, right_growable_row):
        """
        Initialize common sizers
        @param main_rows: Number of rows in main sizer
        @param main_growable_row: Row that is growable in main sizer, None if no
        row is growable
        @param left_rows: Number of rows in left grid sizer
        @param left_growable_row: Row that is growable in left grid sizer, None
        if no row is growable
        @param right_rows: Number of rows in right grid sizer
        @param right_growable_row: Row that is growable in right grid sizer,
        None if no row is growable
        """
        # Create dialog main sizer
        self.MainSizer = wx.FlexGridSizer(cols=1, hgap=0,
                                          rows=main_rows, vgap=10)
        self.MainSizer.AddGrowableCol(0)
        if main_growable_row is not None:
            self.MainSizer.AddGrowableRow(main_growable_row)

        # Create a sizer for dividing parameters in two columns
        self.ColumnSizer = wx.BoxSizer(wx.HORIZONTAL)
        self.MainSizer.AddSizer(self.ColumnSizer, border=20,
                                flag=wx.GROW | wx.TOP | wx.LEFT | wx.RIGHT)

        # Create a sizer for left column
        self.LeftGridSizer = wx.FlexGridSizer(cols=1, hgap=0,
                                              rows=left_rows, vgap=5)
        self.LeftGridSizer.AddGrowableCol(0)
        if left_growable_row is not None:
            self.LeftGridSizer.AddGrowableRow(left_growable_row)
        self.ColumnSizer.AddSizer(self.LeftGridSizer, 1, border=5,
                                  flag=wx.GROW | wx.RIGHT | wx.EXPAND)

        # Create a sizer for right column
        self.RightGridSizer = wx.FlexGridSizer(cols=1, hgap=0,
                                               rows=right_rows, vgap=0)
        self.RightGridSizer.AddGrowableCol(0)
        if right_growable_row is not None:
            self.RightGridSizer.AddGrowableRow(right_growable_row)
        self.ColumnSizer.AddSizer(self.RightGridSizer, 1, border=5,
                                  flag=wx.GROW | wx.LEFT)

        self.SetSizer(self.MainSizer)
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
def __init__(self, parent, pou_type=None, type_readonly=False):
        wx.Dialog.__init__(self, id=-1, parent=parent,
                           name='PouDialog', title=_('Create a new POU'),
                           style=wx.DEFAULT_DIALOG_STYLE)

        main_sizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=10)
        main_sizer.AddGrowableCol(0)
        main_sizer.AddGrowableRow(0)

        infos_sizer = wx.FlexGridSizer(cols=2, hgap=5, rows=3, vgap=15)
        infos_sizer.AddGrowableCol(1)
        main_sizer.AddSizer(infos_sizer, border=20,
                            flag=wx.GROW | wx.TOP | wx.LEFT | wx.RIGHT)

        pouname_label = wx.StaticText(self, label=_('POU Name:'))
        infos_sizer.AddWindow(pouname_label, border=4,
                              flag=wx.ALIGN_CENTER_VERTICAL | wx.TOP)

        self.PouName = wx.TextCtrl(self)
        infos_sizer.AddWindow(self.PouName, flag=wx.GROW)

        poutype_label = wx.StaticText(self, label=_('POU Type:'))
        infos_sizer.AddWindow(poutype_label, border=4,
                              flag=wx.ALIGN_CENTER_VERTICAL | wx.TOP)

        self.PouType = wx.ComboBox(self, style=wx.CB_READONLY)
        self.Bind(wx.EVT_COMBOBOX, self.OnTypeChanged, self.PouType)
        infos_sizer.AddWindow(self.PouType, flag=wx.GROW)

        language_label = wx.StaticText(self, label=_('Language:'))
        infos_sizer.AddWindow(language_label, border=4,
                              flag=wx.ALIGN_CENTER_VERTICAL | wx.TOP)

        self.Language = wx.ComboBox(self, style=wx.CB_READONLY)
        infos_sizer.AddWindow(self.Language, flag=wx.GROW)

        button_sizer = self.CreateButtonSizer(wx.OK | wx.CANCEL | wx.CENTRE)
        self.Bind(wx.EVT_BUTTON, self.OnOK, button_sizer.GetAffirmativeButton())
        main_sizer.AddSizer(button_sizer, border=20,
                            flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT)

        self.SetSizer(main_sizer)

        for option in GetPouTypes():
            if not type_readonly or _(option) == _(pou_type):
                self.PouType.Append(_(option))
        if pou_type is not None:
            self.PouType.SetStringSelection(_(pou_type))
        self.RefreshLanguage()
        self.Fit()
        self.PouNames = []
        self.PouElementNames = []
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
def __init__(self, parent, folder, filter=None, editable=True):
        wx.Panel.__init__(self, parent, style=wx.TAB_TRAVERSAL)

        main_sizer = wx.BoxSizer(wx.VERTICAL)

        self.Tree = wx.TreeCtrl(self,
                                style=(wx.TR_HAS_BUTTONS |
                                       wx.TR_SINGLE |
                                       wx.SUNKEN_BORDER |
                                       wx.TR_HIDE_ROOT |
                                       wx.TR_LINES_AT_ROOT |
                                       wx.TR_EDIT_LABELS))
        if wx.Platform == '__WXMSW__':
            self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnTreeItemExpanded, self.Tree)
            self.Tree.Bind(wx.EVT_LEFT_DOWN, self.OnTreeLeftDown)
        else:
            self.Bind(wx.EVT_TREE_ITEM_EXPANDED, self.OnTreeItemExpanded, self.Tree)
        self.Bind(wx.EVT_TREE_ITEM_COLLAPSED, self.OnTreeItemCollapsed, self.Tree)
        self.Bind(wx.EVT_TREE_BEGIN_LABEL_EDIT, self.OnTreeBeginLabelEdit, self.Tree)
        self.Bind(wx.EVT_TREE_END_LABEL_EDIT, self.OnTreeEndLabelEdit, self.Tree)
        main_sizer.AddWindow(self.Tree, 1, flag=wx.GROW)

        if filter is not None:
            self.Filter = wx.ComboBox(self, style=wx.CB_READONLY)
            self.Bind(wx.EVT_COMBOBOX, self.OnFilterChanged, self.Filter)
            main_sizer.AddWindow(self.Filter, flag=wx.GROW)
        else:
            self.Filter = None

        self.SetSizer(main_sizer)

        self.Folder = folder
        self.Editable = editable

        self.TreeImageList = wx.ImageList(16, 16)
        self.TreeImageDict = {}
        for item_type, bitmap in [(DRIVE, "tree_drive"),
                                  (FOLDER, "tree_folder"),
                                  (FILE, "tree_file")]:
            self.TreeImageDict[item_type] = self.TreeImageList.Add(GetBitmap(bitmap))
        self.Tree.SetImageList(self.TreeImageList)

        self.Filters = {}
        if self.Filter is not None:
            filter_parts = filter.split("|")
            for idx in xrange(0, len(filter_parts), 2):
                if filter_parts[idx + 1] == "*.*":
                    self.Filters[filter_parts[idx]] = ""
                else:
                    self.Filters[filter_parts[idx]] = filter_parts[idx + 1].replace("*", "")
                self.Filter.Append(filter_parts[idx])
                if idx == 0:
                    self.Filter.SetStringSelection(filter_parts[idx])

            self.CurrentFilter = self.Filters[self.Filter.GetStringSelection()]
        else:
            self.CurrentFilter = ""
项目:hco-experiments    作者:zooniverse    | 项目源码 | 文件源码
def create_main_panel(self):

        self.panel = wx.Panel(self)
        self.set_text = wx.StaticText(self.panel, -1, label="Showing : All (%d examples)" % self.m)
        self.set_text.SetBackgroundColour(wx.WHITE)
        font = wx.Font(20, wx.MODERN, wx.NORMAL, wx.BOLD)
        self.set_text.SetFont(font)

        self.hbox1 = wx.BoxSizer(wx.HORIZONTAL)
        self.hbox1.Add(self.set_text, border=5, flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL)

        self.draw_fig(True)
        self.canvas = FigCanvas(self.panel, -1, self.fig)

        # Bind the 'click' event for clicking on one of the axes
        self.canvas.mpl_connect('button_press_event', self.on_click)
        self.navigation_control = NavigationControlBox(self.panel, self, -1, "navigation control")
        #self.label_key_box = LabelKeyBox(self.panel,-1)
        self.data_set_control = DataSetControlBox(self.panel,self,-1)

        self.build_button = wx.Button(self.panel, -1, label="Build")
        self.build_button.Bind(wx.EVT_BUTTON, self.on_build)
        self.reset_button = wx.Button(self.panel, -1, label="Reset")
        self.reset_button.Bind(wx.EVT_BUTTON, self.on_reset)
        self.exit_button = wx.Button(self.panel, -1, label="Exit")
        self.exit_button.Bind(wx.EVT_BUTTON, self.on_exit)

        self.vbox1 = wx.BoxSizer(wx.VERTICAL)
        self.vbox1.Add(self.build_button, 0, flag=wx.CENTER | wx.BOTTOM)
        self.vbox1.Add(self.reset_button, 0, flag=wx.CENTER | wx.BOTTOM)
        self.vbox1.Add(self.exit_button, 0, flag=wx.CENTER | wx.BOTTOM)

        self.hbox2 = wx.BoxSizer(wx.HORIZONTAL)
        #self.hbox2.Add(self.label_key_box, border=5, flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL)
        self.hbox2.Add(self.data_set_control, border=5, flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL)
        self.hbox2.Add(self.navigation_control, border=5, flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL)
        self.hbox2.Add(self.vbox1, border=5, flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL)

        self.vbox2 = wx.BoxSizer(wx.VERTICAL)
        self.vbox2.Add(self.hbox1, 0, flag=wx.CENTER | wx.TOP)
        self.vbox2.Add(self.canvas, 1, flag=wx.CENTER | wx.CENTER | wx.GROW)
        self.vbox2.Add(self.hbox2, 0, flag=wx.LEFT | wx.TOP)

        self.panel.SetSizer(self.vbox2)
        self.vbox2.Fit(self)
项目:hco-experiments    作者:zooniverse    | 项目源码 | 文件源码
def create_main_panel(self):

        self.panel = wx.Panel(self)
        self.set_text = wx.StaticText(self.panel, -1, label="Showing : All (%d examples)" % self.m)
        self.set_text.SetBackgroundColour(wx.WHITE)
        font = wx.Font(20, wx.MODERN, wx.NORMAL, wx.BOLD)
        self.set_text.SetFont(font)

        self.hbox1 = wx.BoxSizer(wx.HORIZONTAL)
        self.hbox1.Add(self.set_text, border=5, flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL)

        self.draw_fig(True)
        self.canvas = FigCanvas(self.panel, -1, self.fig)

        # Bind the 'click' event for clicking on one of the axes
        self.canvas.mpl_connect('button_press_event', self.on_click)
        self.navigation_control = NavigationControlBox(self.panel, self, -1, "navigation control")
        #self.label_key_box = LabelKeyBox(self.panel,-1)
        self.data_set_control = DataSetControlBox(self.panel,self,-1)

        self.build_button = wx.Button(self.panel, -1, label="Build")
        self.build_button.Bind(wx.EVT_BUTTON, self.on_build)
        self.reset_button = wx.Button(self.panel, -1, label="Reset")
        self.reset_button.Bind(wx.EVT_BUTTON, self.on_reset)
        self.exit_button = wx.Button(self.panel, -1, label="Exit")
        self.exit_button.Bind(wx.EVT_BUTTON, self.on_exit)

        self.vbox1 = wx.BoxSizer(wx.VERTICAL)
        self.vbox1.Add(self.build_button, 0, flag=wx.CENTER | wx.BOTTOM)
        self.vbox1.Add(self.reset_button, 0, flag=wx.CENTER | wx.BOTTOM)
        self.vbox1.Add(self.exit_button, 0, flag=wx.CENTER | wx.BOTTOM)

        self.hbox2 = wx.BoxSizer(wx.HORIZONTAL)
        #self.hbox2.Add(self.label_key_box, border=5, flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL)
        self.hbox2.Add(self.data_set_control, border=5, flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL)
        self.hbox2.Add(self.navigation_control, border=5, flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL)
        self.hbox2.Add(self.vbox1, border=5, flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL)

        self.vbox2 = wx.BoxSizer(wx.VERTICAL)
        self.vbox2.Add(self.hbox1, 0, flag=wx.CENTER | wx.TOP)
        self.vbox2.Add(self.canvas, 1, flag=wx.CENTER | wx.CENTER | wx.GROW)
        self.vbox2.Add(self.hbox2, 0, flag=wx.LEFT | wx.TOP)

        self.panel.SetSizer(self.vbox2)
        self.vbox2.Fit(self)
项目:GRIPy    作者:giruenf    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(CrossPlotPanel, self).__init__(*args, **kwargs)
        self.figure = Figure()
        self.canvas = FigureCanvas(self, -1, self.figure)

        self.cmap = Colors.COLOR_MAP_RAINBOW
        self.colorbar = None
        self.collections = []
        self.xdata = None
        self.ydata = None
        self.zdata = None
        self.xlabel = ''
        self.ylabel = ''
        self.zlabel = ''
        self.xlocator = MaxNLocator(6).tick_values
        self.ylocator = MaxNLocator(6).tick_values
        self.zlocator = MaxNLocator(6).tick_values
        self.xlim = None
        self.ylim = None
        self.zlim = None
        self.zmode = 'continuous'
        self.classnames = {}
        self.classcolors = {}
        self.nullclass = np.nan
        self.parts = None
        self.shownparts = []

        rect = [self.MAINAXLEFT, self.MAINAXBOTTOM, self.MAINAXWIDTH, self.MAINAXHEIGHT]
        self.crossplot_ax = self.figure.add_axes(rect)
        self.crossplot_ax.xaxis.set_major_locator(MaxNLocator(5))
        self.crossplot_ax.xaxis.set_major_formatter(NullFormatter())
        self.crossplot_ax.yaxis.set_major_locator(MaxNLocator(5))
        self.crossplot_ax.yaxis.set_major_formatter(NullFormatter())
        self.crossplot_ax.grid(axis='x', which='major', linestyle='-.')
        self.crossplot_ax.grid(axis='y', which='major', linestyle='-.')

        self.create_xlabel()
        self.create_ylabel()
        self.create_zlabel()

        rect = [self.COLORBARLEFT, self.MAINAXBOTTOM, self.COLORBARWIDTH, self.MAINAXHEIGHT]
        self.colorbar_ax = self.figure.add_axes(rect, sharey=self.zlabel_ax)
        #self.colorbar_ax.yaxis.set_major_formatter(NullFormatter())

        self.collectionproperties = dict(linewidths=0.5, s=30)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW)
        self.SetSizer(sizer)
        self.Fit()

        # self.status_bar = self.Parent.StatusBar # TODO: tirar isso quando voltar a status_bar

        self.canvas.mpl_connect('button_press_event', self.on_press)
        self.canvas.mpl_connect('motion_notify_event', self.on_move)
项目:GRIPy    作者:giruenf    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(CrossPlotPanel, self).__init__(*args, **kwargs)
        self.figure = Figure()
        self.canvas = FigureCanvas(self, -1, self.figure)

        self.cmap = Colors.COLOR_MAP_RAINBOW
        self.colorbar = None
        self.collections = []
        self.xdata = None
        self.ydata = None
        self.zdata = None
        self.xlabel = ''
        self.ylabel = ''
        self.zlabel = ''
        self.xlocator = MaxNLocator(6).tick_values
        self.ylocator = MaxNLocator(6).tick_values
        self.zlocator = MaxNLocator(6).tick_values
        self.xlim = None
        self.ylim = None
        self.zlim = None
        self.zmode = 'continuous'
        self.classnames = {}
        self.classcolors = {}
        self.nullclass = np.nan
        self.parts = None
        self.shownparts = []

        rect = [self.MAINAXLEFT, self.MAINAXBOTTOM, self.MAINAXWIDTH, self.MAINAXHEIGHT]
        self.crossplot_ax = self.figure.add_axes(rect)
        self.crossplot_ax.xaxis.set_major_locator(MaxNLocator(5))
        self.crossplot_ax.xaxis.set_major_formatter(NullFormatter())
        self.crossplot_ax.yaxis.set_major_locator(MaxNLocator(5))
        self.crossplot_ax.yaxis.set_major_formatter(NullFormatter())
        self.crossplot_ax.grid(axis='x', which='major', linestyle='-.')
        self.crossplot_ax.grid(axis='y', which='major', linestyle='-.')

        self.create_xlabel()
        self.create_ylabel()
        self.create_zlabel()

        rect = [self.COLORBARLEFT, self.MAINAXBOTTOM, self.COLORBARWIDTH, self.MAINAXHEIGHT]
        self.colorbar_ax = self.figure.add_axes(rect, sharey=self.zlabel_ax)
        #self.colorbar_ax.yaxis.set_major_formatter(NullFormatter())

        self.collectionproperties = dict(linewidths=0.5, s=30)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW)
        self.SetSizer(sizer)
        self.Fit()

        # self.status_bar = self.Parent.StatusBar # TODO: tirar isso quando voltar a status_bar

        self.canvas.mpl_connect('button_press_event', self.on_press)
        self.canvas.mpl_connect('motion_notify_event', self.on_move)