Python wx 模块,ALIGN_LEFT 实例源码

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

项目:SIMreader    作者:stoic1979    | 项目源码 | 文件源码
def createWidgets(self):
        # Main window resizer object
        sizer = wx.BoxSizer(wx.VERTICAL) 

        sizer.Add(topPanel(self, self.SIM), 1, wx.ALL|wx.EXPAND, 5)
        sizer.Add(bottomPanel(self, self.SIM), 1, wx.ALL|wx.EXPAND, 5)
        #buttons = wx.BoxSizer(wx.HORIZONTAL)
        #buttons.Add(wx.Button(self, ID_BUTTON_CHANGE_PIN, "Okay"), 1, wx.ALIGN_LEFT | wx.ALL, 20)
        #buttons.Add(wx.Button(self, wxID_CANCEL, "Cancel"), 1, wx.ALIGN_RIGHT | wx.ALL, 20)
        #sizer.Add(buttons, 1, wx.ALL)

        self.SetSizer(sizer) 
        self.SetAutoLayout(1) 
        sizer.Fit(self)
        self.Layout()

        wx.EVT_CLOSE(self, self.closeWindow)
项目:LalkaChat    作者:DeForce    | 项目源码 | 文件源码
def create_spin(**kwargs):
        panel = kwargs.get('panel')
        value = kwargs.get('value')
        key = kwargs.get('key')
        bind = kwargs.get('bind')
        gui = kwargs.get('gui')

        item_sizer = wx.BoxSizer(wx.HORIZONTAL)
        item_name = MODULE_KEY.join(key)
        style = wx.ALIGN_LEFT
        item_box = wx.SpinCtrl(panel, id=id_renew(item_name, update=True), min=gui['min'], max=gui['max'],
                               initial=int(value), style=style)
        item_text = wx.StaticText(panel, label=translate_key(item_name))
        item_box.Bind(wx.EVT_SPINCTRL, bind)
        item_box.Bind(wx.EVT_TEXT, bind)
        item_sizer.Add(item_text, 0, wx.ALIGN_CENTER)
        item_sizer.Add(item_box)
        return {'item': item_sizer, 'text_size': item_text.GetSize()[0], 'text_ctrl': item_text}
项目:Cognitive-Face-Python    作者:Microsoft    | 项目源码 | 文件源码
def OnDrawItem(self, dc, rect, index):
        """OnDrawItem for Layout."""
        face = self.faces[index]
        dc.DrawBitmap(face.bmp, rect.x + 2,
                      ((rect.height - face.bmp.GetHeight()) / 2) + rect.y)

        textx = rect.x + 2 + face.bmp.GetWidth() + 2
        label_rect = wx.Rect(textx, rect.y, rect.width - textx, rect.height)
        label = util.LABEL_FACE.format(
            face.attr.gender,
            face.attr.age,
            face.attr.hair,
            face.attr.facial_hair,
            face.attr.makeup,
            face.attr.emotion,
            face.attr.occlusion,
            face.attr.exposure,
            face.attr.head_pose,
            face.attr.accessories
        )
        dc.DrawLabel(label, label_rect, wx.ALIGN_LEFT | wx.ALIGN_TOP)
项目:SIMreader    作者:stoic1979    | 项目源码 | 文件源码
def __init__(self, parent, name, number, minnamelen, maxnamelen):
        wxskinDialog.__init__(self, parent, -1, "Phonebook edit entry")
        self.SetAutoLayout(True)
        self.name = None
        self.number = None
        nameTextId = wx.NewId()

        # Main window resizer object
        border = wx.BoxSizer(wx.VERTICAL)

        label = wx.StaticText(self, -1, "Enter the phonebook entry name, number and press OK.")
        border.Add(label, 1, wx.ALL, 10)

        #fgs = wx.FlexGridSizer(2,3,5,20)
        fgs = wx.BoxSizer(wx.HORIZONTAL)
        label = wx.StaticText(self, -1, "Name (max %d): " % maxnamelen)
        fgs.Add(label, 1, wx.ALIGN_LEFT | wx.LEFT, 10)
        self.nameCtrl = wx.TextCtrl(self, nameTextId, name, validator = pySIMvalidator(None, minnamelen, maxnamelen))
        fgs.Add(self.nameCtrl, 1, wx.ALIGN_RIGHT | wx.RIGHT, 10)
        border.Add(fgs, 1, wx.ALL)

        fgs = wx.BoxSizer(wx.HORIZONTAL)
        label = wx.StaticText(self, -1, "Number (max 20): ")
        fgs.Add(label, 1, wx.ALIGN_LEFT | wx.LEFT, 10)
        self.numberCtrl = wx.TextCtrl(self, -1, number, validator = pySIMvalidator("+*#pw0123456789", None, 20))
        fgs.Add(self.numberCtrl, 1, wx.ALIGN_RIGHT | wx.RIGHT, 10)
        border.Add(fgs, 1, wx.ALL)

        buttons = wx.BoxSizer(wx.HORIZONTAL)
        buttons.Add(wx.Button(self, ID_BUTTON_OK, "Okay"), 1, wx.ALIGN_LEFT | wx.ALL, 20)
        buttons.Add(wx.Button(self, wx.ID_CANCEL, "Cancel"), 1, wx.ALIGN_RIGHT | wx.ALL, 20)
        border.Add(buttons, 1, wx.ALL)

        wx.EVT_BUTTON(self, ID_BUTTON_OK, self.onOK)
        wx.EVT_TEXT_ENTER(self, nameTextId, self.onOK)

        self.SetAutoLayout(1);
        self.SetSizer(border)
        border.Fit(self)
        self.Layout()
项目:SIMreader    作者:stoic1979    | 项目源码 | 文件源码
def __init__(self, parent, name):
        wxskinDialog.__init__(self, parent, -1, "Phonebook import")
        self.SetAutoLayout(True)
        self.function = 0

        # Main window resizer object
        border = wx.BoxSizer(wx.VERTICAL)

        label = wx.StaticText(self, -1, "Name '%s' already exists in SIM phonebook.\n\nDo you want to overwrite exisiting, duplicate or skip!?" % (name))
        border.Add(label, 1, wx.ALL, 10)

        buttons = wx.BoxSizer(wx.HORIZONTAL)
        buttons.Add(wx.Button(self, ID_BUTTON_OVERWRITE, "Overwrite"), 1, wx.ALIGN_LEFT | wx.ALL, 20)
        buttons.Add(wx.Button(self, ID_BUTTON_COPY, "Duplicate"), 1, wx.ALIGN_RIGHT | wx.ALL, 20)
        buttons.Add(wx.Button(self, ID_BUTTON_SKIP, "Skip"), 1, wx.ALIGN_RIGHT | wx.ALL, 20)
        buttons.Add(wx.Button(self, wx.ID_CANCEL, "Cancel"), 1, wx.ALIGN_RIGHT | wx.ALL, 20)
        border.Add(buttons, 1, wx.ALL)

        self.applyAll = wx.CheckBox(self, ID_CHECKBOX_APPLY_ALL,   "  Apply to all", wx.Point(65, 40), wx.Size(150, 20), wx.NO_BORDER)
        border.Add(self.applyAll, 1, wx.ALIGN_CENTER | wx.ALL)

        wx.EVT_BUTTON(self, ID_BUTTON_OVERWRITE, self.onOverwrite)
        wx.EVT_BUTTON(self, ID_BUTTON_COPY, self.onDuplicate)
        wx.EVT_BUTTON(self, ID_BUTTON_SKIP, self.onSkip)

        self.SetAutoLayout(1);
        self.SetSizer(border)
        border.Fit(self)
        self.Layout()
项目:SIMreader    作者:stoic1979    | 项目源码 | 文件源码
def __init__(self, parent, name, number, minnamelen, maxnamelen):
        wxskinDialog.__init__(self, parent, -1, "Phonebook edit entry")
        self.SetAutoLayout(True)
        self.name = None
        self.number = None
        nameTextId = wx.NewId()

        # Main window resizer object
        border = wx.BoxSizer(wx.VERTICAL)

        label = wx.StaticText(self, -1, "Enter the phonebook entry name, number and press OK.")
        border.Add(label, 1, wx.ALL, 10)

        #fgs = wx.FlexGridSizer(2,3,5,20)
        fgs = wx.BoxSizer(wx.HORIZONTAL)
        label = wx.StaticText(self, -1, "Name (max %d): " % maxnamelen)
        fgs.Add(label, 1, wx.ALIGN_LEFT | wx.LEFT, 10)
        self.nameCtrl = wx.TextCtrl(self, nameTextId, name, validator = pySIMvalidator(None, minnamelen, maxnamelen))
        fgs.Add(self.nameCtrl, 1, wx.ALIGN_RIGHT | wx.RIGHT, 10)
        border.Add(fgs, 1, wx.ALL)

        fgs = wx.BoxSizer(wx.HORIZONTAL)
        label = wx.StaticText(self, -1, "Number (max 20): ")
        fgs.Add(label, 1, wx.ALIGN_LEFT | wx.LEFT, 10)
        self.numberCtrl = wx.TextCtrl(self, -1, number, validator = pySIMvalidator("+*#pw0123456789", None, 20))
        fgs.Add(self.numberCtrl, 1, wx.ALIGN_RIGHT | wx.RIGHT, 10)
        border.Add(fgs, 1, wx.ALL)

        buttons = wx.BoxSizer(wx.HORIZONTAL)
        buttons.Add(wx.Button(self, ID_BUTTON_OK, "Okay"), 1, wx.ALIGN_LEFT | wx.ALL, 20)
        buttons.Add(wx.Button(self, wx.ID_CANCEL, "Cancel"), 1, wx.ALIGN_RIGHT | wx.ALL, 20)
        border.Add(buttons, 1, wx.ALL)

        wx.EVT_BUTTON(self, ID_BUTTON_OK, self.onOK)
        wx.EVT_TEXT_ENTER(self, nameTextId, self.onOK)

        self.SetAutoLayout(1);
        self.SetSizer(border)
        border.Fit(self)
        self.Layout()
项目:SIMreader    作者:stoic1979    | 项目源码 | 文件源码
def __init__(self, parent, name):
        wxskinDialog.__init__(self, parent, -1, "Phonebook import")
        self.SetAutoLayout(True)
        self.function = 0

        # Main window resizer object
        border = wx.BoxSizer(wx.VERTICAL)

        label = wx.StaticText(self, -1, "Name '%s' already exists in SIM phonebook.\n\nDo you want to overwrite exisiting, duplicate or skip!?" % (name))
        border.Add(label, 1, wx.ALL, 10)

        buttons = wx.BoxSizer(wx.HORIZONTAL)
        buttons.Add(wx.Button(self, ID_BUTTON_OVERWRITE, "Overwrite"), 1, wx.ALIGN_LEFT | wx.ALL, 20)
        buttons.Add(wx.Button(self, ID_BUTTON_COPY, "Duplicate"), 1, wx.ALIGN_RIGHT | wx.ALL, 20)
        buttons.Add(wx.Button(self, ID_BUTTON_SKIP, "Skip"), 1, wx.ALIGN_RIGHT | wx.ALL, 20)
        buttons.Add(wx.Button(self, wx.ID_CANCEL, "Cancel"), 1, wx.ALIGN_RIGHT | wx.ALL, 20)
        border.Add(buttons, 1, wx.ALL)

        self.applyAll = wx.CheckBox(self, ID_CHECKBOX_APPLY_ALL,   "  Apply to all", wx.Point(65, 40), wx.Size(150, 20), wx.NO_BORDER)
        border.Add(self.applyAll, 1, wx.ALIGN_CENTER | wx.ALL)

        wx.EVT_BUTTON(self, ID_BUTTON_OVERWRITE, self.onOverwrite)
        wx.EVT_BUTTON(self, ID_BUTTON_COPY, self.onDuplicate)
        wx.EVT_BUTTON(self, ID_BUTTON_SKIP, self.onSkip)

        self.SetAutoLayout(1);
        self.SetSizer(border)
        border.Fit(self)
        self.Layout()
项目:SIMreader    作者:stoic1979    | 项目源码 | 文件源码
def __init__(self, parent, date, number):
        wxskinDialog.__init__(self, parent, -1, "SMS import")
        self.SetAutoLayout(False)
        self.function = 0

        # Main window resizer object
        border = wx.BoxSizer(wx.VERTICAL)

        label = wx.StaticText(self, -1, "SMS from '%s' on '%s' already exists in SMS folder.\n\nDo you want to overwrite exisiting, duplicate or skip!?" % (number, date))
        border.Add(label, 1, wx.ALL, 10)

        buttons = wx.BoxSizer(wx.HORIZONTAL)
        buttons.Add(wx.Button(self, ID_BUTTON_OVERWRITE, "Overwrite"), 1, wx.ALIGN_LEFT | wx.ALL, 20)
        buttons.Add(wx.Button(self, ID_BUTTON_COPY, "Duplicate"), 1, wx.ALIGN_RIGHT | wx.ALL, 20)
        buttons.Add(wx.Button(self, ID_BUTTON_SKIP, "Skip"), 1, wx.ALIGN_RIGHT | wx.ALL, 20)
        buttons.Add(wx.Button(self, wx.ID_CANCEL, "Cancel"), 1, wx.ALIGN_RIGHT | wx.ALL, 20)
        border.Add(buttons, 1, wx.ALL)

        self.applyAll = wx.CheckBox(self, ID_CHECKBOX_APPLY_ALL,   "  Apply to all", wx.Point(65, 40), wx.Size(150, 20), wx.NO_BORDER)
        border.Add(self.applyAll, 1, wx.ALIGN_CENTER | wx.ALL)

        wx.EVT_BUTTON(self, ID_BUTTON_OVERWRITE, self.onOverwrite)
        wx.EVT_BUTTON(self, ID_BUTTON_COPY, self.onDuplicate)
        wx.EVT_BUTTON(self, ID_BUTTON_SKIP, self.onSkip)
        #EVT_CHECKBOX(self, ID_CHECKBOX_APPLY_ALL, self.EvtCheckBox)

        self.SetAutoLayout(1);
        self.SetSizer(border)
        border.Fit(self)
        self.Layout()
项目:fmc-dialer    作者:sguron    | 项目源码 | 文件源码
def UpdateCallHistory(self):
        history = self.wxapp.dialed_history[:50]
        history.reverse()
        iterhistory = iter(history)
        startrow = 3
        startcol = 1
        row = 0
        col = 0

        windows = iter(list(self.recenthistory_panel.GetChildren()))
        #dont remove the transparent header.. just skip over it  #NEXT IT ;)
        next(windows)
        for window in windows:
            self.recenthistory_sizer.Detach(window)
            window.Destroy()
        self.recenthistory_sizer.Layout()

        #self.recenthistory_sizer.AddSpacer( ( 5, 1 ), wx.GBPosition( 0, startcol + col ), wx.GBSpan( 1, 1 ), wx.FIXED_MINSIZE, 0 )
        #self.recenthistory_sizer.AddSpacer( ( 5, 1 ), wx.GBPosition( 0, startcol + col + 2 ), wx.GBSpan( 1, 1 ), wx.FIXED_MINSIZE, 0 )
        #self.recenthistory_sizer.AddSpacer( ( 5, 1 ), wx.GBPosition( 0, startcol + col + 4 ), wx.GBSpan( 1, 1 ), wx.FIXED_MINSIZE, 0 )

        for row in range(5):
            try:
                for col in range(3):
                    call = next(iterhistory)
                    #print "Adding call to pane;", call
                    rc1 = LastdialedPanel(call[0], call[1], self.dialRecent, u"images/panel/recentcallbg.png",
                                          self.recenthistory_panel, wx.ID_ANY, )
                    self.recenthistory_sizer.Add(rc1, wx.GBPosition(startrow + row + 1, startcol + col),
                                                 wx.GBSpan(1, 1), wx.ALIGN_LEFT, 0)
                if row != 0:
                    try:
                        self.recenthistory_sizer.AddSpacer(( 2, 63 ), wx.GBPosition(startrow + row, 0), wx.GBSpan(1, 1),
                                                           wx.FIXED_MINSIZE, 0)
                    except:
                        pass
            except StopIteration:
                break
项目:bonsu    作者:bonsudev    | 项目源码 | 文件源码
def __init__(self, parent, id=wx.ID_ANY, label="", style=wx.ALIGN_LEFT, size=(-1,-1)):
        wx.StaticText.__init__(self, parent, id, label=label, style=style, size=size)
项目:bonsu    作者:bonsudev    | 项目源码 | 文件源码
def __init__(self, parent, id=wx.ID_ANY, value="", style=wx.ALIGN_LEFT, size=(-1,-1)):
        wx.TextCtrl.__init__(self, parent, id, value=value, style=style, size=size)
项目:bonsu    作者:bonsudev    | 项目源码 | 文件源码
def __init__(self, parent, id=wx.ID_ANY, label="", style=wx.ALIGN_LEFT, size=(-1,-1)):
        wx.Button.__init__(self, parent, id, label=label, style=style, size=size)
项目:bonsu    作者:bonsudev    | 项目源码 | 文件源码
def __init__(self, parent, id=wx.ID_ANY, bitmap=wx.NullBitmap, style=wx.ALIGN_LEFT, size=(-1,-1)):
        wx.BitmapButton.__init__(self, parent, id, bitmap=bitmap, style=style, size=size)
项目:bonsu    作者:bonsudev    | 项目源码 | 文件源码
def __init__(self, parent, id=wx.ID_ANY, label="", style=wx.ALIGN_LEFT, size=(-1,-1)):
        wx.CheckBox.__init__(self, parent, id, label=label, style=style, size=size)
项目:bonsu    作者:bonsudev    | 项目源码 | 文件源码
def __init__(self, parent, id=wx.ID_ANY, style=wx.ALIGN_LEFT, size=(-1,-1), spinfunc=None):
        wx.Panel.__init__(self, parent)
        self.hbox = wx.BoxSizer(wx.HORIZONTAL)
        self.buttonP = wx.Button(self, -1, label="+", size=size)
        self.buttonM = wx.Button(self, -1, label="-", size=size)
        self.buttonP.Bind(wx.EVT_BUTTON, self.OnP)
        self.buttonM.Bind(wx.EVT_BUTTON, self.OnM)
        self.repeatTimerP = wx.Timer(self)
        self.repeatTimerM = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.RepeatValueP, self.repeatTimerP)
        self.Bind(wx.EVT_TIMER, self.RepeatValueM, self.repeatTimerM)
        self.buttonP.Bind(wx.EVT_LEFT_DOWN, self.OnButPDown)
        self.buttonM.Bind(wx.EVT_LEFT_DOWN, self.OnButMDown)
        self.buttonP.Bind(wx.EVT_LEFT_UP, self.OnButPUp)
        self.buttonM.Bind(wx.EVT_LEFT_UP, self.OnButMUp)
        self.hbox.Add(self.buttonM, 0)
        self.hbox.Add(self.buttonP, 0)
        self.SetSizer(self.hbox)
        self.Fit()
        self.Layout()
        self.Show()
        self.max = 0
        self.min = 0
        self.range = 0
        self.value = 0
        self.SpinFunc = spinfunc
        self.n = 1
        self.t1 = time()
        self.t2 = time()
项目:magic-card-database    作者:drknotter    | 项目源码 | 文件源码
def update_current_search_tab(self):

        sizer = self.current_sizer
        sizer.Clear(True)
        sizer.RemoveGrowableRow(0)
        sizer.RemoveGrowableRow(1)
        sizer.RemoveGrowableCol(0)
        sizer.RemoveGrowableCol(2)

        if( len(self.current_search) == 0 ):

            sizer.AddGrowableRow(0)
            sizer.AddGrowableCol(0)
            sizer.Add(wx.StaticText(parent=self.current_tab,label="There are no search items."),flag=wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL,pos=(0,0))

        else:

            sizer.AddGrowableCol(2)

            for i in range(len(self.current_search)):
                if i%2 == 0:
                    not_box = wx.ComboBox(parent=self.current_tab,value=self.current_search[i][0],choices=['','not'],style=wx.CB_READONLY,size=(60,-1),id=i/2)
                    not_box.Bind(wx.EVT_COMBOBOX,self.not_search_item)
                    sizer.Add(not_box,pos=(i,0),flag=wx.ALIGN_LEFT|wx.TOP,border=5)

                    key = self.current_search[i][1]
                    value = self.current_search[i][2]
                    sizer.Add(wx.StaticText(parent=self.current_tab,label=key+" = '"+value+"'"),pos=(i,1),flag=wx.TOP|wx.LEFT|wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL,border=5)

                    removeButton = wx.Button(self.current_tab,label='Remove',id=i/2)
                    removeButton.Bind(wx.EVT_BUTTON,self.remove_search_item)
                    sizer.Add(removeButton,pos=(i,2),flag=wx.ALIGN_RIGHT|wx.TOP,border=5)
                else:
                    and_or_box = wx.ComboBox(parent=self.current_tab,value=self.current_search[i],choices=['and','or'],style=wx.CB_READONLY,size=(60,-1),id=(i-1)/2)
                    and_or_box.Bind(wx.EVT_COMBOBOX,self.and_or_search_item)
                    sizer.Add(and_or_box,pos=(i,0),flag=wx.ALIGN_LEFT|wx.TOP,border=5)

            self.current_tab.EnableScrolling(x_scrolling=True,y_scrolling=True)
            self.current_tab.SetScrollbars(20,20,10,10)

        self.current_tab.Fit()
项目:magic-card-database    作者:drknotter    | 项目源码 | 文件源码
def update_current_search_tab(self):

        sizer = self.current_sizer
        sizer.Clear(True)
        sizer.RemoveGrowableRow(0)
        sizer.RemoveGrowableRow(1)
        sizer.RemoveGrowableCol(0)
        sizer.RemoveGrowableCol(2)

        if( len(self.current_search) == 0 ):

            sizer.AddGrowableRow(0)
            sizer.AddGrowableCol(0)
            sizer.Add(wx.StaticText(parent=self.current_tab,label="There are no search items."),flag=wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL,pos=(0,0))

        else:

            sizer.AddGrowableCol(2)

            for i in range(len(self.current_search)):
                if i%2 == 0:
                    not_box = wx.ComboBox(parent=self.current_tab,value=self.current_search[i][0],choices=['','not'],style=wx.CB_READONLY,size=(60,-1),id=i/2)
                    not_box.Bind(wx.EVT_COMBOBOX,self.not_search_item)
                    sizer.Add(not_box,pos=(i,0),flag=wx.ALIGN_LEFT|wx.TOP,border=5)

                    key = self.current_search[i][1]
                    value = self.current_search[i][2]
                    sizer.Add(wx.StaticText(parent=self.current_tab,label=key+" = '"+value+"'"),pos=(i,1),flag=wx.TOP|wx.LEFT|wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL,border=5)

                    removeButton = wx.Button(self.current_tab,label='Remove',id=i/2)
                    removeButton.Bind(wx.EVT_BUTTON,self.remove_search_item)
                    sizer.Add(removeButton,pos=(i,2),flag=wx.ALIGN_RIGHT|wx.TOP,border=5)
                else:
                    and_or_box = wx.ComboBox(parent=self.current_tab,value=self.current_search[i],choices=['and','or'],style=wx.CB_READONLY,size=(60,-1),id=(i-1)/2)
                    and_or_box.Bind(wx.EVT_COMBOBOX,self.and_or_search_item)
                    sizer.Add(and_or_box,pos=(i,0),flag=wx.ALIGN_LEFT|wx.TOP,border=5)

            self.current_tab.EnableScrolling(x_scrolling=True,y_scrolling=True)
            self.current_tab.SetScrollbars(20,20,10,10)

        self.current_tab.Fit()
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        CT.CustomTreeCtrl.__init__(self, *args, **kwargs)

        self.BackgroundBitmap = None
        self.BackgroundAlign = wx.ALIGN_LEFT | wx.ALIGN_TOP

        self.AddMenu = None
        self.Enabled = False

        self.Bind(wx.EVT_SCROLLWIN, self.OnScroll)
        self.Bind(wx.EVT_LEFT_UP, self.OnLeftUp)
项目:LalkaChat    作者:DeForce    | 项目源码 | 文件源码
def create_checkbox(**kwargs):
        panel = kwargs.get('panel')
        value = kwargs.get('value')
        key = kwargs.get('key')
        bind = kwargs.get('bind')

        item_sizer = wx.BoxSizer(wx.HORIZONTAL)
        style = wx.ALIGN_CENTER_VERTICAL
        item_key = MODULE_KEY.join(key)
        item_box = wx.CheckBox(panel, id=id_renew(item_key, update=True),
                               label=translate_key(item_key), style=style)
        item_box.SetValue(value)
        item_box.Bind(wx.EVT_CHECKBOX, bind)
        item_sizer.Add(item_box, 0, wx.ALIGN_LEFT)
        return {'item': item_sizer}
项目:Cognitive-Face-Python    作者:Microsoft    | 项目源码 | 文件源码
def __init__(self, parent, confidence_faces, size=util.MAX_THUMBNAIL_SIZE):
        super(WrapCaptionFaceList, self).__init__()
        for face, confidence in confidence_faces:
            vsizer = wx.BoxSizer(wx.VERTICAL)
            bitmap = MyStaticBitmap(parent, face.bmp, size=size)
            vsizer.Add(bitmap)
            static_text = wx.StaticText(parent, label='%.2f' % confidence)
            vsizer.Add(static_text)
            self.Add(vsizer, 0, wx.ALIGN_LEFT | wx.EXPAND)
            vsizer.Layout()
        if len(confidence_faces) == 0:
            static_text = wx.StaticText(parent, label='no one')
            self.Add(static_text, 0, wx.ALIGN_LEFT | wx.EXPAND)
        self.Layout()
项目:Cognitive-Face-Python    作者:Microsoft    | 项目源码 | 文件源码
def set_data(self, faces, res_tot, size=util.MAX_THUMBNAIL_SIZE):
        """Set the data."""
        self.sizer.Clear(True)
        static_text_title = wx.StaticText(
            self, label='Find {} Similar Candidate Faces Results:'.format(
                len(faces)))
        self.sizer.Add(static_text_title, 0, wx.EXPAND)

        for mode in ('matchPerson', 'matchFace'):
            static_text_caption = wx.StaticText(
                self, label='{} Mode:'.format(mode))
            self.sizer.Add(static_text_caption, 0, wx.EXPAND)

            for face_id, face in faces.iteritems():

                static_line = wx.StaticLine(self)
                self.sizer.Add(static_line, 0, wx.EXPAND)

                bitmap = MyStaticBitmap(self, face.bmp, size=size)
                self.sizer.Add(bitmap, 0, wx.ALIGN_LEFT)

                static_text = wx.StaticText(
                    self, label='Similar Faces Ranked by Similarity')
                self.sizer.Add(static_text, 0, wx.ALIGN_LEFT)

                confidence_face_list = WrapCaptionFaceList(
                    self, res_tot[mode][face_id])
                self.sizer.Add(confidence_face_list, 0, wx.EXPAND)
        self.SetSizerAndFit(self.sizer)
项目:Cognitive-Face-Python    作者:Microsoft    | 项目源码 | 文件源码
def __init__(self, parent, faces, size=util.MAX_THUMBNAIL_SIZE):
        super(WrapFaceList, self).__init__(parent)
        self.sizer = wx.WrapSizer()
        self.sizer.SetMinSize((util.MAX_IMAGE_SIZE, -1))
        for face in faces:
            bitmap = MyStaticBitmap(self, face.bmp, size=size)
            self.sizer.Add(bitmap, 0, wx.ALIGN_LEFT | wx.EXPAND)
        self.SetSizer(self.sizer)
        self.Layout()
项目:Cognitive-Face-Python    作者:Microsoft    | 项目源码 | 文件源码
def set_data(self, caption_faces_list, size=util.MAX_THUMBNAIL_SIZE):
        """Set the data."""
        self.sizer.Clear(True)

        for caption, faces in caption_faces_list.iteritems():
            static_text = wx.StaticText(self, label=caption)
            self.sizer.Add(static_text, 0, wx.ALIGN_LEFT)
            wrap_face_list = WrapFaceList(self, faces, size)
            self.sizer.Add(wrap_face_list, 0, wx.EXPAND)

        self.SetSizerAndFit(self.sizer)
项目: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)
项目:SIMreader    作者:stoic1979    | 项目源码 | 文件源码
def createWidgets(self):
        # Main window resizer object
        border = wx.BoxSizer(wx.VERTICAL)

        label = wxskinStaticText(self, -1, "Your old and new PIN must be exactly 4 digits in length.")
        border.Add(label, 1, wx.ALL, 10)

        fgs = wx.BoxSizer(wx.HORIZONTAL)
        label = wxskinStaticText(self, -1, "Current PIN: ")
        fgs.Add(label, 1, wx.ALIGN_LEFT | wx.LEFT, 10)
        if self.SIM.chv1_enabled:
            self.textCtrlOldPin = wx.TextCtrl(self, -1, '', validator = pySIMvalidator("0123456789", 4, 4), style=wx.TE_PASSWORD)
        else:
            self.textCtrlOldPin = wx.TextCtrl(self, -1, '(Not set)', style=wx.TE_READONLY)
        fgs.Add(self.textCtrlOldPin, 1, wx.ALIGN_RIGHT | wx.RIGHT, 10)
        border.Add(fgs, 1, wx.ALL)

        fgs = wx.BoxSizer(wx.HORIZONTAL)
        label = wxskinStaticText(self, -1, "New PIN: ")
        fgs.Add(label, 1, wx.ALIGN_LEFT | wx.LEFT, 10)
        self.textCtrlNewPin1 = wx.TextCtrl(self, -1, '', validator = pySIMvalidator("0123456789", 4, 4), style=wx.TE_PASSWORD)
        fgs.Add(self.textCtrlNewPin1, 1, wx.ALIGN_RIGHT | wx.RIGHT, 10)
        border.Add(fgs, 1, wx.ALL)

        fgs = wx.BoxSizer(wx.HORIZONTAL)
        label = wxskinStaticText(self, -1, "New PIN (verify): ")
        fgs.Add(label, 1, wx.ALIGN_LEFT | wx.LEFT, 10)
        self.textCtrlNewPin2 = wx.TextCtrl(self, -1, '', validator = pySIMvalidator("0123456789", 4, 4), style=wx.TE_PASSWORD)
        fgs.Add(self.textCtrlNewPin2, 1, wx.ALIGN_RIGHT | wx.RIGHT, 10)
        border.Add(fgs, 1, wx.ALL)

        buttons = wx.BoxSizer(wx.HORIZONTAL)
        buttons.Add(wx.Button(self, ID_BUTTON_CHANGE_PIN, "Okay"), 1, wx.ALIGN_LEFT | wx.ALL, 20)
        buttons.Add(wx.Button(self, wx.ID_CANCEL, "Cancel"), 1, wx.ALIGN_RIGHT | wx.ALL, 20)
        border.Add(buttons, 1, wx.ALL)

        wx.EVT_BUTTON(self, ID_BUTTON_CHANGE_PIN, self.onOK)

        self.SetAutoLayout(1);
        self.SetSizer(border)
        border.Fit(self)
        self.Layout()
项目:magic-card-database    作者:drknotter    | 项目源码 | 文件源码
def update_my_library_grid(self):

        self.my_library.sort(key=self.key_sort,reverse=(True if self.my_library_sort_by[1]=='^' else False))        

        self.parent.statusbar.SetStatusText('Displaying library...')
        vcenter = wx.grid.GridCellAttr()
        vcenter.SetAlignment(wx.ALIGN_LEFT,wx.ALIGN_CENTER)
        self.my_library_grid.DeleteRows(0,self.my_library_grid.GetNumberRows()) 
        self.my_library_grid.DeleteCols(0,self.my_library_grid.GetNumberCols())

        nCols = 0
        for colName in self.my_library_fields:
            self.my_library_grid.AppendCols()
            colLabel = colName if self.my_library_sort_by[0]!=colName else (colName+' '+self.my_library_sort_by[1])
            self.my_library_grid.SetColLabelValue(nCols,colLabel)
            nCols += 1

        self.my_library_grid.Hide()
        for card in self.my_library:
            r = self.my_library_grid.GetNumberRows()
            self.my_library_grid.AppendRows()
            nCols = 0
            for colName in self.my_library_fields:
                self.my_library_grid.SetCellValue(r,nCols,unicode(card[COL_TRANSLATE[colName]]))
                nCols += 1
            self.my_library_grid.SetRowAttr(r,vcenter)
            self.my_library_grid.EnableDragRowSize(False)
            self.parent.progressbar.SetValue(int(float(r)/float(len(self.my_library))*100))
            self.parent.progressbar.Update()

        for i in range(self.my_library_grid.GetNumberCols()):
            self.my_library_grid.AutoSizeColumn(i)

        self.parent.progressbar.SetValue(0)
        self.my_library_grid.Show()
        self.my_library_grid.SetRowLabelSize(wx.grid.GRID_AUTOSIZE)
        self.my_library_grid.SetColLabelSize(wx.grid.GRID_AUTOSIZE)

        if len(self.my_library) > 0:
            self.parent.card_info.update_card(self.my_library[0])

        self.parent.statusbar.SetStatusText('Ready.')
        self.my_library_tab.EnableScrolling(x_scrolling=True,y_scrolling=True)
        self.my_library_tab.Fit()
项目:magic-card-database    作者:drknotter    | 项目源码 | 文件源码
def update_results_grid(self):

        self.results.sort(key=self.key_sort,reverse=(True if self.result_sort_by[1]=='^' else False))        

        self.parent.statusbar.SetStatusText('Displaying results...')
        vcenter = wx.grid.GridCellAttr()
        vcenter.SetAlignment(wx.ALIGN_LEFT,wx.ALIGN_CENTER)
        self.results_grid.DeleteRows(0,self.results_grid.GetNumberRows()) 
        self.results_grid.DeleteCols(0,self.results_grid.GetNumberCols())

        nCols = 0
        for colName in self.result_fields:
            self.results_grid.AppendCols()
            colLabel = colName if self.result_sort_by[0]!=colName else (colName+' '+self.result_sort_by[1])
            self.results_grid.SetColLabelValue(nCols,colLabel)
            nCols += 1

        self.results_grid.Hide()
        for card in self.results:
            r = self.results_grid.GetNumberRows()
            self.results_grid.AppendRows()
            nCols = 0
            for colName in self.result_fields:
                self.results_grid.SetCellValue(r,nCols,unicode(card[COL_TRANSLATE[colName]]))
                nCols += 1
            self.results_grid.SetRowAttr(r,vcenter)
            self.results_grid.EnableDragRowSize(False)
            self.parent.progressbar.SetValue(int(float(r)/float(len(self.results))*100))
            self.parent.progressbar.Update()

        self.results_grid.AutoSize()

        self.parent.progressbar.SetValue(0)
        self.results_grid.Show()
        self.results_grid.SetRowLabelSize(wx.grid.GRID_AUTOSIZE)
        self.results_grid.SetColLabelSize(wx.grid.GRID_AUTOSIZE)

        if len(self.results) > 0:
            self.parent.card_info.update_card(self.results[0])

        self.parent.statusbar.SetStatusText('Found %d matches.' % len(self.results))
        self.results_tab.EnableScrolling(x_scrolling=True,y_scrolling=True)
        self.results_tab.Fit()
项目:pyjam    作者:10se1ucgo    | 项目源码 | 文件源码
def __init__(self, parent):
        super(DownloaderDialog, self).__init__(parent, title="pyjam Downloader",
                                               style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
        self.parent = parent

        self.audio_links = wx.TextCtrl(self)
        audio_link_text = wx.StaticText(self, label="URL(s) (Separate with commas)")

        self.out_dir = wx.DirPickerCtrl(self, path=os.path.abspath("downloads"))
        out_dir_text = wx.StaticText(self, label="Output directory")

        warning_text = wx.StaticText(self, style=wx.ALIGN_CENTRE_HORIZONTAL,
                                     label=("Note: The program will freeze for a bit while it processes the URL "
                                            "before downloading"))
        warning_text.Wrap(self.GetSize()[0])

        search_button = wx.Button(self, label="Search")

        top_sizer = wx.BoxSizer(wx.VERTICAL)
        control_sizer = wx.BoxSizer(wx.VERTICAL)
        text_sizer = wx.BoxSizer(wx.VERTICAL)
        button_sizer = self.CreateButtonSizer(wx.OK | wx.CANCEL)

        control_sizer.Add(audio_link_text, 0, wx.ALL ^ wx.LEFT | wx.ALIGN_LEFT, 3)
        control_sizer.Add(self.audio_links, 0, wx.ALL ^ wx.LEFT ^ wx.TOP | wx.ALIGN_LEFT | wx.EXPAND, 5)
        control_sizer.Add(out_dir_text, 0, wx.ALL ^ wx.LEFT | wx.ALIGN_LEFT, 3)
        control_sizer.Add(self.out_dir, 0, wx.ALL ^ wx.LEFT ^ wx.TOP | wx.ALIGN_LEFT | wx.EXPAND, 5)
        text_sizer.Add(warning_text, 0, wx.ALL | wx.ALIGN_CENTER, 5)
        button_sizer.Add(search_button)
        top_sizer.Add(control_sizer, 1, wx.ALL | wx.EXPAND | wx.ALIGN_TOP, 5)
        top_sizer.Add(text_sizer, 0, wx.ALL | wx.ALIGN_CENTER, 5)
        top_sizer.Add(button_sizer, 0, wx.ALL | wx.ALIGN_CENTER, 5)

        self.Bind(wx.EVT_BUTTON, handler=self.on_ok, id=wx.ID_OK)
        self.Bind(wx.EVT_BUTTON, handler=lambda x: SearchDialog(self), source=search_button)

        self.downloader = None
        self.progress_dialog = None
        self.num_songs = 0

        self.SetSizerAndFit(top_sizer)
        self.Center()
        self.ShowModal()
项目:GRIPy    作者:giruenf    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        if 'size' not in kwargs:
            kwargs['size'] = (640, 480)

        super(Dialog, self).__init__(*args, **kwargs)

        self._OM = ObjectManager(self)

        self.currentwellindex = 0
        self.currentrocktableindex = 0

        self.tables = []

        self.rocktablemap = [rocktable.uid for rocktable in self._OM.list('rocktable')]
        work_table = []
        for rocktable in self._OM.list('rocktable'):
            work_table.append(RockTable(rocktable.uid))
        self.tables.append(work_table)
        self.grid = wx.grid.Grid(self)
        self.grid.SetDefaultColSize(100)

#        else:
        self.grid.SetTable(self.tables[self.currentwellindex][self.currentrocktableindex])
        self.grid.Bind(wx.grid.EVT_GRID_CELL_LEFT_DCLICK, self.on_cell_dlclick)
        self.grid.Bind(wx.grid.EVT_GRID_LABEL_LEFT_DCLICK, self.on_label_dlclick)

        toolbar_sizer = wx.BoxSizer(wx.HORIZONTAL)

        self.rocktable_choice = wx.Choice(self)
        self.rocktable_choice.AppendItems([self._OM.get(rocktableuid).name for rocktableuid in self.rocktablemap])
        self.rocktable_choice.SetSelection(self.currentrocktableindex)
        self.rocktable_choice.Bind(wx.EVT_CHOICE, self.on_rocktable_choice)

        add_rocktype_button = wx.Button(self, label='ADD ROCK TYPE')
        add_rocktype_button.Bind(wx.EVT_BUTTON, self.on_add_rocktype)

        remove_rocktype_button = wx.Button(self, label='REM ROCK TYPE')
        remove_rocktype_button.Bind(wx.EVT_BUTTON, self.on_remove_rocktype)

        toolbar_sizer.Add(self.rocktable_choice, 1, wx.ALIGN_LEFT)
        toolbar_sizer.Add(add_rocktype_button, 0, wx.ALIGN_LEFT)
        toolbar_sizer.Add(remove_rocktype_button, 0, wx.ALIGN_LEFT)

        main_sizer = wx.BoxSizer(wx.VERTICAL)
        main_sizer.Add(toolbar_sizer, proportion=0, flag=wx.EXPAND)
        main_sizer.Add(self.grid, proportion=1, flag=wx.EXPAND)

        self.SetSizer(main_sizer)
项目:pyjam    作者:10se1ucgo    | 项目源码 | 文件源码
def __init__(self, parent, rate=None, out_dir=None, in_dir=None):
        super(FFmpegConvertDialog, self).__init__(parent=parent, title="pyjam Audio Converter",
                                                  style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)

        self.in_dir = in_dir

        self.game_rate = intctrl.IntCtrl(self)
        game_rate_text = wx.StaticText(self, label="Audio rate")
        if rate is not None:
            self.game_rate.SetValue(rate)

        self.volume = wx.SpinCtrl(self, initial=85)
        volume_text = wx.StaticText(self, label="Volume %")

        self.in_picker = wx.FilePickerCtrl(self, style=wx.FLP_USE_TEXTCTRL)
        in_picker_text = wx.StaticText(self, label="Input file names (manually changing them has no effect)")
        self.in_files = []
        # the dumbest thing i've done all year (i'm overriding the controls of the PickerBase)
        for child in self.in_picker.GetChildren():
            if isinstance(child, wx.Button):
                child.Bind(wx.EVT_BUTTON, self.browse)

        self.out_dir = wx.DirPickerCtrl(self, name="Output directory")
        out_dir_text = wx.StaticText(self, label="Output directory")
        if out_dir is not None:
            self.out_dir.SetPath(out_dir)

        top_sizer = wx.BoxSizer(wx.VERTICAL)
        top_row = wx.BoxSizer(wx.HORIZONTAL)
        rate_sizer = wx.BoxSizer(wx.VERTICAL)
        vol_sizer = wx.BoxSizer(wx.VERTICAL)
        dir_sizer = wx.BoxSizer(wx.VERTICAL)
        button_sizer = self.CreateButtonSizer(wx.OK | wx.CANCEL)

        rate_sizer.Add(game_rate_text, 0, wx.ALL ^ wx.BOTTOM | wx.ALIGN_LEFT, 5)
        rate_sizer.Add(self.game_rate, 0, wx.ALL | wx.ALIGN_LEFT, 5)
        vol_sizer.Add(volume_text, 0, wx.ALL ^ wx.BOTTOM | wx.ALIGN_LEFT, 5)
        vol_sizer.Add(self.volume, 0, wx.ALL | wx.ALIGN_LEFT, 5)
        top_row.Add(rate_sizer)
        top_row.Add(vol_sizer)
        dir_sizer.Add(in_picker_text, 0, wx.ALL ^ wx.LEFT | wx.ALIGN_LEFT, 3)
        dir_sizer.Add(self.in_picker, 0, wx.ALL ^ wx.LEFT ^ wx.TOP | wx.ALIGN_LEFT | wx.EXPAND, 5)
        dir_sizer.Add(out_dir_text, 0, wx.ALL ^ wx.LEFT | wx.ALIGN_LEFT, 3)
        dir_sizer.Add(self.out_dir, 0, wx.ALL ^ wx.LEFT ^ wx.TOP | wx.ALIGN_LEFT | wx.EXPAND, 5)
        top_sizer.Add(top_row)
        top_sizer.Add(dir_sizer, 1, wx.ALL | wx.EXPAND | wx.ALIGN_TOP, 5)
        top_sizer.Add(button_sizer, 0, wx.ALL | wx.ALIGN_CENTER, 5)

        self.Bind(wx.EVT_BUTTON, self.on_ok, id=wx.ID_OK)
        self.Bind(wx.EVT_BUTTON, self.on_cancel, id=wx.ID_CANCEL)

        self.converter = None
        self.progress_dialog = None
        self.num_songs = 0

        self.SetSizer(top_sizer)
        # self.SetSize(400, 250)
        self.Center()
        self.ShowModal()