Python wx 模块,StdDialogButtonSizer() 实例源码

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

项目: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)
项目:wxWize    作者:AndersMunch    | 项目源码 | 文件源码
def __init__(self, parent):
        wx.Dialog.__init__(self, parent, -1, title=u"Logon", style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER)
        vsizer = wx.BoxSizer(orient=wx.VERTICAL)
        gb = wx.GridBagSizer()
        gb.Add(wx.StaticText(self, -1, u"Username"), flag=wx.ALL|wx.EXPAND, border=10, pos=(0,0))
        self._name = wx.TextCtrl(self, -1)
        gb.Add(self._name, flag=wx.ALL|wx.EXPAND, border=10, pos=(0,1))
        gb.Add(wx.StaticText(self, -1, u"Password"), flag=wx.ALL|wx.EXPAND, pos=(1,0), border=10)
        self._pass = wx.TextCtrl(self, -1, style=wx.TE_PASSWORD)
        gb.Add(self._pass, border=10, flag=wx.EXPAND|wx.ALL, pos=(1,1))
        gb.AddGrowableCol(1)
        butsz = wx.StdDialogButtonSizer()
        okbut = wx.Button(self, wx.ID_OK, u"OK")
        butsz.AddButton(okbut)
        cbut = wx.Button(self, wx.ID_CANCEL, u"Cancel")
        butsz.AddButton(cbut)
        insp = wx.Button(self, wx.ID_HELP, u"Help")
        butsz.AddButton(insp)
        insp.Bind(wx.EVT_BUTTON, InspectionTool().Show)
        butsz.Realize()
        okbut.SetDefault()
        vsizer.Add(gb, 0, wx.EXPAND)
        vsizer.Add(butsz, 0, wx.EXPAND)
        self.SetSizer(vsizer)
        self.Fit()
项目:wxWize    作者:AndersMunch    | 项目源码 | 文件源码
def create_preorder(self):
        self.w = self.sized = (self.w or wx.StdDialogButtonSizer())
项目: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)
项目:wxpythoncookbookcode    作者:driscollis    | 项目源码 | 文件源码
def createWidgets(self):
        """
        Create and layout the widgets in the dialog
        """
        lblSizer = wx.BoxSizer(wx.VERTICAL)
        valueSizer = wx.BoxSizer(wx.VERTICAL)
        btnSizer = wx.StdDialogButtonSizer()
        colSizer = wx.BoxSizer(wx.HORIZONTAL)
        mainSizer = wx.BoxSizer(wx.VERTICAL)

        iniFile = "config.ini"
        self.config = configobj.ConfigObj(iniFile)

        labels = self.config["Labels"]
        values = self.config["Values"]
        self.widgetNames = values
        font = wx.Font(12, wx.SWISS, wx.NORMAL, wx.BOLD)

        for key in labels:
            value = labels[key]
            lbl = wx.StaticText(self, label=value)
            lbl.SetFont(font)
            lblSizer.Add(lbl, 0, wx.ALL, 5)

        for key in values:
            print(key)
            value = values[key]
            if isinstance(value, list):
                default = value[0]
                choices = value[1:]
                cbo = wx.ComboBox(self, value=value[0],
                                  size=wx.DefaultSize, choices=choices, 
                                  style=wx.CB_DROPDOWN|wx.CB_READONLY, 
                                  name=key)
                valueSizer.Add(cbo, 0, wx.ALL, 5)
            else:
                txt = wx.TextCtrl(self, value=value, name=key)
                valueSizer.Add(txt, 0, wx.ALL|wx.EXPAND, 5)

        saveBtn = wx.Button(self, wx.ID_OK, label="Save")
        saveBtn.Bind(wx.EVT_BUTTON, self.onSave)
        btnSizer.AddButton(saveBtn)

        cancelBtn = wx.Button(self, wx.ID_CANCEL)
        btnSizer.AddButton(cancelBtn)
        btnSizer.Realize()

        colSizer.Add(lblSizer)
        colSizer.Add(valueSizer, 1, wx.EXPAND)
        mainSizer.Add(colSizer, 0, wx.EXPAND)
        mainSizer.Add(btnSizer, 0, wx.ALL | wx.ALIGN_RIGHT, 5)
        self.SetSizer(mainSizer)