Python wx 模块,ALIGN_CENTRE 实例源码

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

项目:imagepy    作者:Image-Py    | 项目源码 | 文件源码
def add_num(self, rang, accu, title, key, unit):
        sizer = wx.BoxSizer( wx.HORIZONTAL )
        lab_title = wx.StaticText( self, wx.ID_ANY, title,
                                  wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE )

        lab_title.Wrap( -1 )
        sizer.Add( lab_title, 0, wx.ALIGN_CENTER|wx.ALL, 5 )
        ctrl = NumCtrl(self, rang, accu)
        self.ctrl_dic[key] = ctrl
        ctrl.Bind(wx.EVT_KEY_UP, lambda x : self.para_changed(key))
        sizer.Add( ctrl, 2, wx.ALL, 5 )

        lab_unit = wx.StaticText( self, wx.ID_ANY, unit,
                                  wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE )

        lab_unit.Wrap( -1 )
        sizer.Add( lab_unit, 0, wx.ALIGN_CENTER|wx.ALL, 5 )
        self.tus.append((lab_title, lab_unit))
        self.lst.Add( sizer, 0, wx.EXPAND, 5 )
项目:imagepy    作者:Image-Py    | 项目源码 | 文件源码
def add_color(self, title, key, unit):
        sizer = wx.BoxSizer( wx.HORIZONTAL )
        lab_title = wx.StaticText( self, wx.ID_ANY, title,
                                   wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE )

        lab_title.Wrap( -1 )
        sizer.Add( lab_title, 0, wx.ALIGN_CENTER|wx.ALL, 5 )
        ctrl = ColorCtrl(self)
        self.ctrl_dic[key] = ctrl
        ctrl.Bind(wx.EVT_KEY_UP, lambda x : self.para_changed(key))
        sizer.Add( ctrl, 2, wx.ALL, 5 )

        lab_unit = wx.StaticText( self, wx.ID_ANY, unit,
                                  wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE )

        lab_unit.Wrap( -1 )
        sizer.Add( lab_unit, 0, wx.ALIGN_CENTER|wx.ALL, 5 )
        self.tus.append((lab_title, lab_unit))
        self.lst.Add( sizer, 0, wx.EXPAND, 5 )
项目:imagepy    作者:Image-Py    | 项目源码 | 文件源码
def add_slide(self, rang, title, key, unit):
        sizer = wx.BoxSizer( wx.HORIZONTAL )
        lab_title = wx.StaticText( self, wx.ID_ANY, title,
                                   wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE )

        lab_title.Wrap( -1 )
        sizer.Add( lab_title, 0, wx.ALIGN_CENTER|wx.ALL, 5 )
        iswin = platform.system() == 'Windows'
        lab  = wx.SL_VALUE_LABEL if iswin else wx.SL_LABELS

        ctrl = wx.Slider( self, wx.ID_ANY, 50, rang[0], rang[1],
                          wx.DefaultPosition, wx.Size( -1,-1 ), wx.SL_HORIZONTAL|lab )

        self.ctrl_dic[key] = ctrl
        ctrl.Bind(wx.EVT_SCROLL, lambda x : self.para_changed(key))
        sizer.Add( ctrl, 2, wx.ALL, 5 )

        lab_unit = wx.StaticText( self, wx.ID_ANY, unit,
                                  wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE )

        lab_unit.Wrap( -1 )
        sizer.Add( lab_unit, 0, wx.ALIGN_CENTER|wx.ALL, 5 )
        self.tus.append((lab_title, lab_unit))
        self.lst.Add( sizer, 0, wx.EXPAND, 5 )
项目:imagepy    作者:Image-Py    | 项目源码 | 文件源码
def add_txt(self, title, key, unit):
        sizer = wx.BoxSizer( wx.HORIZONTAL )
        lab_title = wx.StaticText( self, wx.ID_ANY, title,
                                   wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE )

        lab_title.Wrap( -1 )
        sizer.Add( lab_title, 0, wx.ALIGN_CENTER|wx.ALL, 5 )

        ctrl = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString,
                            wx.DefaultPosition, wx.DefaultSize, 0 )

        self.ctrl_dic[key] = ctrl
        ctrl.Bind( wx.EVT_KEY_UP, lambda x : self.para_changed(key))
        sizer.Add( ctrl, 2, wx.ALL, 5 )

        lab_unit = wx.StaticText( self, wx.ID_ANY, unit,
                                  wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE )

        lab_unit.Wrap( -1 )
        sizer.Add( lab_unit, 0, wx.ALIGN_CENTER|wx.ALL, 5 )
        self.tus.append((lab_title, lab_unit))
        self.lst.Add( sizer, 0, wx.EXPAND, 5 )
项目:imagepy    作者:Image-Py    | 项目源码 | 文件源码
def add_choice(self, choices, tp, title, key, unit):
        sizer = wx.BoxSizer( wx.HORIZONTAL )
        lab_title = wx.StaticText( self, wx.ID_ANY, title,
                                   wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE )

        lab_title.Wrap( -1 )
        sizer.Add( lab_title, 0, wx.ALIGN_CENTER|wx.ALL, 5 )

        ctrl = wx.Choice( self, wx.ID_ANY,
                          wx.DefaultPosition, wx.DefaultSize,
                          [str(choice) for choice in choices], 0 )

        ctrl.SetSelection(0)
        ctrl.SetValue = lambda x:ctrl.SetSelection(choices.index(x))
        ctrl.GetValue = lambda : tp(choices[ctrl.GetSelection()])
        self.ctrl_dic[key] = ctrl
        ctrl.Bind( wx.EVT_CHOICE, lambda x : self.para_changed(key))
        sizer.Add( ctrl, 2, wx.ALL, 5 )

        lab_unit = wx.StaticText( self, wx.ID_ANY, unit,
                                  wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE )

        lab_unit.Wrap( -1 )
        sizer.Add( lab_unit, 0, wx.ALIGN_CENTER|wx.ALL, 5 )
        self.tus.append((lab_title, lab_unit))
        self.lst.Add( sizer, 0, wx.EXPAND, 5 )
项目: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)
项目:fritzchecksum    作者:mementum    | 项目源码 | 文件源码
def __init__( self, parent ):
        wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = u"About", pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )

        self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )

        bSizer8 = wx.BoxSizer( wx.VERTICAL )

        self.m_notebookAbout = wx.Notebook( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0 )
        self.m_panelAbout = wx.Panel( self.m_notebookAbout, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
        bSizer10 = wx.BoxSizer( wx.VERTICAL )


        bSizer10.AddSpacer( ( 0, 0), 1, wx.EXPAND|wx.ALIGN_CENTER_HORIZONTAL, 5 )

        self.m_staticTextAppNameVersion = wx.StaticText( self.m_panelAbout, wx.ID_ANY, u"MyLabel", wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE )
        self.m_staticTextAppNameVersion.Wrap( -1 )
        bSizer10.Add( self.m_staticTextAppNameVersion, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 5 )

        self.m_staticTextCopyright = wx.StaticText( self.m_panelAbout, wx.ID_ANY, u"MyLabel", wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE )
        self.m_staticTextCopyright.Wrap( -1 )
        bSizer10.Add( self.m_staticTextCopyright, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 5 )

        self.m_hyperlinkURL = wx.HyperlinkCtrl( self.m_panelAbout, wx.ID_ANY, u"wxFB Website", u"http://www.wxformbuilder.org", wx.DefaultPosition, wx.DefaultSize, wx.HL_ALIGN_CENTRE|wx.HL_DEFAULT_STYLE )
        bSizer10.Add( self.m_hyperlinkURL, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 5 )


        bSizer10.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 )


        self.m_panelAbout.SetSizer( bSizer10 )
        self.m_panelAbout.Layout()
        bSizer10.Fit( self.m_panelAbout )
        self.m_notebookAbout.AddPage( self.m_panelAbout, u"About", True )

        bSizer8.Add( self.m_notebookAbout, 1, wx.EXPAND |wx.ALL, 5 )

        self.m_buttonClose = wx.Button( self, wx.ID_ANY, u"Close", wx.DefaultPosition, wx.DefaultSize, 0 )
        bSizer8.Add( self.m_buttonClose, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL, 5 )


        self.SetSizer( bSizer8 )
        self.Layout()
        bSizer8.Fit( self )

        self.Centre( wx.BOTH )
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def __init__(self, *args, **kwds):
        # Constructor



        kwds["style"] = wx.CAPTION|wx.CLOSE_BOX|wx.MINIMIZE_BOX
        wx.Frame.__init__(self, *args, **kwds)
        try:

            self.Parent.Hide()


        except:
            print "Error Closing Prent"

        self.label_1 = wx.StaticText(self, -1, "Year", style=wx.ALIGN_RIGHT|wx.ALIGN_CENTRE)
        self.combo_box_1 = wx.ComboBox(self, -1, choices=[ ], style=wx.CB_DROPDOWN|wx.CB_DROPDOWN|wx.CB_READONLY | wx.CB_SORT)


        self.label_2 = wx.StaticText(self, -1, "Standard", style=wx.ALIGN_RIGHT|wx.ALIGN_CENTRE)

        self.combo_box_2 = wx.ComboBox(self, -1, choices=[  'Select',"8", "9", "10"], style=wx.CB_DROPDOWN|wx.CB_DROPDOWN|wx.CB_READONLY)
        self.label_3 = wx.StaticText(self, -1, "Div", style=wx.ALIGN_CENTRE)
        self.combo_box_3 = wx.ComboBox(self, -1, choices=[ 'Select',], style=wx.CB_DROPDOWN|wx.CB_DROPDOWN|wx.CB_READONLY | wx.CB_SORT)
        self.label_4 = wx.StaticText(self, -1, "Term", style=wx.ALIGN_CENTRE)


        self.combo_box_4 = wx.ComboBox(self, -1, choices=[ 'Select', "Term 1", "Term 2", "Annual"], style=wx.CB_DROPDOWN|wx.CB_DROPDOWN|wx.CB_READONLY)


        self.button_1 = wx.Button(self, -1, "Close")
        self.button_2 = wx.Button(self, -1, "Go")

        #self.SetMenu()

        self.__set_properties()
        self.__do_layout()
        self.IsGridChild=0

        self.Bind(wx.EVT_COMBOBOX, self.on_year, self.combo_box_1)
        self.Bind(wx.EVT_COMBOBOX, self.on_class, self.combo_box_2)
        self.Bind(wx.EVT_COMBOBOX, self.on_division, self.combo_box_3)

        self.Bind(wx.EVT_BUTTON, self.Go_Clicked, self.button_2)
        self.Bind(wx.EVT_BUTTON, self.Cancel_Clicked, self.button_1)
        self.Bind(wx.EVT_CLOSE, self.OnClose)
        self.GridFrame = None

        self.YEAR=''
        #self.CalcSheet=SpreadSheet(self)

        self.DB=db_operations()
        self.load_year()
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def __init__(self, *args, **kwds):
        # Constructor

        kwds["style"] = wx.CAPTION|wx.CLOSE_BOX|wx.MINIMIZE_BOX
        wx.Dialog.__init__(self, *args, **kwds)


        self.label_1 = wx.StaticText(self, -1, "Year", style=wx.ALIGN_RIGHT|wx.ALIGN_CENTRE)
        self.combo_box_1 = wx.ComboBox(self, -1, choices=[], style=wx.CB_DROPDOWN|wx.CB_DROPDOWN|wx.CB_READONLY)


        self.label_2 = wx.StaticText(self, -1, "Standard", style=wx.ALIGN_RIGHT|wx.ALIGN_CENTRE)

        self.combo_box_2 = wx.ComboBox(self, -1, choices=[ 'All',"8", "9"], style=wx.CB_DROPDOWN|wx.CB_DROPDOWN|wx.CB_READONLY)
        #self.label_3 = wx.StaticText(self, -1, "Division", style=wx.ALIGN_CENTRE)
        #self.combo_box_3 = wx.ComboBox(self, -1, choices=['All'], style=wx.CB_DROPDOWN|wx.CB_DROPDOWN|wx.CB_READONLY)
        #self.label_4 = wx.StaticText(self, -1, "Term", style=wx.ALIGN_CENTRE)
        #self.button_3 = wx.Button(self, -1, "Import File")

        #self.combo_box_4 = wx.ComboBox(self, -1, choices=[ "Term 1", "Term 2", "Annual"], style=wx.CB_DROPDOWN|wx.CB_DROPDOWN|wx.CB_READONLY)


        self.button_2 = wx.Button(self, -1, "Proceed")
        self.button_1 = wx.Button(self, -1, "Close")


        #self.SetMenu()

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_COMBOBOX, self.on_year, self.combo_box_1)
        self.Bind(wx.EVT_COMBOBOX, self.on_class, self.combo_box_2)
        #self.Bind(wx.EVT_COMBOBOX, self.on_division, self.combo_box_3)

        self.Bind(wx.EVT_BUTTON, self.ok_clicked, self.button_2)
        self.Bind(wx.EVT_BUTTON,self.on_close, self.button_1)

        #self.CalcSheet=SpreadSheet(self)
        self.YEAR=''
        self.DIVS=[]
        self.DB=db_operations()
        self.load_year()
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def __init__(self, *args, **kwds):
        # Constructor

        kwds["style"] = wx.CAPTION|wx.CLOSE_BOX|wx.MINIMIZE_BOX
        wx.Dialog.__init__(self, *args, **kwds)


        self.label_1 = wx.StaticText(self, -1, "Year", style=wx.ALIGN_RIGHT|wx.ALIGN_CENTRE)
        self.combo_box_1 = wx.ComboBox(self, -1, choices=[], style=wx.CB_DROPDOWN|wx.CB_DROPDOWN|wx.CB_READONLY)


        self.label_2 = wx.StaticText(self, -1, "Standard", style=wx.ALIGN_RIGHT|wx.ALIGN_CENTRE)

        self.combo_box_2 = wx.ComboBox(self, -1, choices=[ 'Select',"8", "9", "10"], style=wx.CB_DROPDOWN|wx.CB_DROPDOWN|wx.CB_READONLY)
        self.label_3 = wx.StaticText(self, -1, "Division", style=wx.ALIGN_CENTRE)
        self.combo_box_3 = wx.ComboBox(self, -1, choices=['Select'], style=wx.CB_DROPDOWN|wx.CB_DROPDOWN|wx.CB_READONLY)
        #self.label_4 = wx.StaticText(self, -1, "Term", style=wx.ALIGN_CENTRE)
        #self.button_3 = wx.Button(self, -1, "Import File")

        #self.combo_box_4 = wx.ComboBox(self, -1, choices=[ "Term 1", "Term 2", "Annual"], style=wx.CB_DROPDOWN|wx.CB_DROPDOWN|wx.CB_READONLY)


        self.button_2 = wx.Button(self, -1, "Import")
        self.button_1 = wx.Button(self, -1, "Close")


        #self.SetMenu()

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_COMBOBOX, self.on_year, self.combo_box_1)
        self.Bind(wx.EVT_COMBOBOX, self.on_class, self.combo_box_2)
        self.Bind(wx.EVT_COMBOBOX, self.on_division, self.combo_box_3)

        self.Bind(wx.EVT_BUTTON, self.ok_clicked, self.button_2)
        self.Bind(wx.EVT_BUTTON, self.cancel_clicked, self.button_1)
        self.Bind(wx.EVT_CLOSE, self.on_close)

        #self.CalcSheet=SpreadSheet(self)
        self.YEAR=''
        self.DB=db_operations()
        self.load_year()