当前位置: 首页>>代码示例>>Python>>正文


Python wx.Choice方法代码示例

本文整理汇总了Python中wx.Choice方法的典型用法代码示例。如果您正苦于以下问题:Python wx.Choice方法的具体用法?Python wx.Choice怎么用?Python wx.Choice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在wx的用法示例。


在下文中一共展示了wx.Choice方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Choice [as 别名]
def __init__(self, *args, **kwds):
        kwds["style"] = wx.DEFAULT_DIALOG_STYLE
        wx.Dialog.__init__(self, *args, **kwds)
        self.label_2_copy = wx.StaticText(self, -1, _("Family:"))
        self.label_3_copy = wx.StaticText(self, -1, _("Style:"))
        self.label_4_copy = wx.StaticText(self, -1, _("Weight:"))
        self.family = wx.Choice(self, -1, choices=["Default", "Decorative", "Roman", "Script", "Swiss", "Modern"])
        self.style = wx.Choice(self, -1, choices=["Normal", "Slant", "Italic"])
        self.weight = wx.Choice(self, -1, choices=["Normal", "Light", "Bold"])
        self.label_1 = wx.StaticText(self, -1, _("Size in points:"))
        self.point_size = wx.SpinCtrl(self, -1, "", min=0, max=100)
        self.underline = wx.CheckBox(self, -1, _("Underlined"))
        self.font_btn = wx.Button(self, -1, _("Specific font..."))
        self.static_line_1 = wx.StaticLine(self, -1)
        self.ok_btn = wx.Button(self, wx.ID_OK, _("OK"))
        self.cancel_btn = wx.Button(self, wx.ID_CANCEL, _("Cancel"))

        self.__set_properties()
        self.__do_layout()
        self.value = None
        self.font_btn.Bind(wx.EVT_BUTTON, self.choose_specific_font)
        self.ok_btn.Bind(wx.EVT_BUTTON, self.on_ok) 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:24,代码来源:font_dialog.py

示例2: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Choice [as 别名]
def __init__(self, *args, **kwds):
        # begin wxGlade: MyFrame.__init__
        kwds["style"] = kwds.get("style", 0)
        wx.Frame.__init__(self, *args, **kwds)
        self.SetTitle("frame_1")

        sizer_1 = wx.BoxSizer(wx.VERTICAL)

        sizer_2 = wx.BoxSizer(wx.VERTICAL)
        sizer_1.Add(sizer_2, 1, 0, 0)

        self.choice_1 = wx.Choice(self, wx.ID_ANY, choices=["Pure ASCII", u"German Umlauts äöüÄÖÜß"])
        self.choice_1.SetSelection(1)
        sizer_2.Add(self.choice_1, 1, wx.ALL | wx.EXPAND, 5)

        self.label_1 = wx.StaticText(self, wx.ID_ANY, u"German Umlauts äöüÄÖÜß", style=wx.ALIGN_CENTER)
        sizer_2.Add(self.label_1, 1, wx.ALL | wx.EXPAND, 5)

        self.SetSizer(sizer_1)
        sizer_1.Fit(self)

        self.Layout()
        # end wxGlade

# end of class MyFrame 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:27,代码来源:bug166.py

示例3: row_box

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Choice [as 别名]
def row_box(self, row):

        label = wx.TextCtrl(self.panel, -1, value=self.var_names[row])
        model_input_types = ["Scalar", "Time series", "Grid", "Grid sequence"]
        dlist = wx.Choice(self.panel, -1, choices=model_input_types)
        #  Set to current input type here
        text  = wx.TextCtrl(self.panel, -1, self.var_setting[row])
        ustr  = wx.StaticText(self.panel, -1, self.var_units[row])
        # self.Bind(wx.EVT_CHOICE, self.onChoice, self.var_type)

        box = wx.BoxSizer(wx.HORIZONTAL)
        box.Add(label, 0, wx.GROW, border=self.pad)
        box.Add(dlist, 0, wx.GROW, border=self.pad)
        box.Add(text,  0, wx.GROW, border=self.pad)
        box.Add(ustr,  0, wx.GROW, border=self.pad)
        # box.AddMany([label, dlist, text, ustr])  #, 1, wx.EXPAND) 
        # self.SetSizer(box)
        return box
    
    #---------------------------------------------
    #  Create sizer box for the process timestep
    #--------------------------------------------- 
开发者ID:peckhams,项目名称:topoflow,代码行数:24,代码来源:Input_Dialog_OLD2.py

示例4: Configure

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Choice [as 别名]
def Configure(self, osd="", dur=3, pos=1):
        panel = eg.ConfigPanel()
        osdLabel = wx.StaticText(panel,-1,self.text.osdLabel)
        posLabel = wx.StaticText(panel,-1,self.text.posLabel)
        durLabel = wx.StaticText(panel,-1,self.text.durLabel)
        osdCtrl = wx.TextCtrl(panel,-1,osd, size=(200,-1))
        durCtrl = eg.SpinIntCtrl(panel, -1, dur, max=99999)
        posCtrl = wx.Choice(panel,-1,choices=self.text.position)
        posCtrl.SetSelection(pos)
        sizer = wx.FlexGridSizer(3, 2, 5, 10)
        sizer.Add(osdLabel,0,wx.TOP,3)
        sizer.Add(osdCtrl)
        sizer.Add(durLabel,0,wx.TOP,3)
        sizer.Add(durCtrl)
        sizer.Add(posLabel,0,wx.TOP,3)
        sizer.Add(posCtrl)
        panel.sizer.Add(sizer,0,wx.ALL|wx.EXPAND,20)

        while panel.Affirmed():
            panel.SetResult(
                osdCtrl.GetValue(),
                durCtrl.GetValue(),
                posCtrl.GetSelection(),
            )
#=============================================================================== 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:27,代码来源:__init__.py

示例5: Configure

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Choice [as 别名]
def Configure(self, imageFileName='', style=1):
        panel = eg.ConfigPanel()
        text = self.text
        filepathCtrl = eg.FileBrowseButton(
            panel,
            size = (340, -1),
            initialValue = imageFileName,
            labelText = "",
            fileMask = text.fileMask,
            buttonText = eg.text.General.browse,
        )
        choice = wx.Choice(panel, -1, choices=text.choices)
        choice.SetSelection(style)
        sizer = panel.sizer
        sizer.Add(panel.StaticText(text.text1), 0, wx.EXPAND)
        sizer.Add(filepathCtrl, 0, wx.EXPAND)
        sizer.Add(panel.StaticText(text.text2), 0, wx.EXPAND | wx.TOP, 10)
        sizer.Add(choice, 0, wx.BOTTOM, 10)

        while panel.Affirmed():
            panel.SetResult(filepathCtrl.GetValue(), choice.GetSelection()) 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:23,代码来源:__init__.py

示例6: display_opt_widget_row

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Choice [as 别名]
def display_opt_widget_row(self, row_id):
        """Return a display option widget row."""
        statbox_disp_opts = self.sizer_disp_opts.GetStaticBox()
        row_id = wx.StaticText(statbox_disp_opts, -1, str(row_id))
        row_sax = wx.Choice(statbox_disp_opts, -1, name="SwivelAxisChoice",
                            size=(self.tc_width*0.7, -1),
                            choices=["No swivel", "Left", "Right"])
        row_san = wx.TextCtrl(statbox_disp_opts, -1, size=(self.tc_width*0.69, -1),
                              style=wx.TE_RIGHT)
        row_sol = wx.TextCtrl(statbox_disp_opts, -1, size=(self.tc_width*0.69, -1),
                              style=wx.TE_RIGHT)
        row_sod = wx.TextCtrl(statbox_disp_opts, -1, size=(self.tc_width*0.69, -1),
                              style=wx.TE_RIGHT)
        row_tan = wx.TextCtrl(statbox_disp_opts, -1, size=(self.tc_width*0.69, -1),
                              style=wx.TE_RIGHT)
        row_tov = wx.TextCtrl(statbox_disp_opts, -1, size=(self.tc_width*0.69, -1),
                              style=wx.TE_RIGHT)
        row_tod = wx.TextCtrl(statbox_disp_opts, -1, size=(self.tc_width*0.69, -1),
                              style=wx.TE_RIGHT)
        # Prefill neutral data
        row_sax.SetSelection(0)
        row_san.SetValue("0")
        row_sol.SetValue("0")
        row_sod.SetValue("0")
        row_tan.SetValue("0")
        row_tov.SetValue("0")
        row_tod.SetValue("0")

        row = [row_id, row_sax, row_san, row_sol, row_sod, row_tan, row_tov, row_tod]
        return row 
开发者ID:hhannine,项目名称:superpaper,代码行数:32,代码来源:configuration_dialogs.py

示例7: create_sizer_profiles

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Choice [as 别名]
def create_sizer_profiles(self):
        # choice menu
        self.list_of_profiles = list_profiles()
        self.profnames = []
        for prof in self.list_of_profiles:
            self.profnames.append(prof.name)
        self.profnames.append("Create a new profile")
        self.choice_profiles = wx.Choice(self, -1, name="ProfileChoice", choices=self.profnames)
        self.choice_profiles.Bind(wx.EVT_CHOICE, self.onSelect)
        st_choice_profiles = wx.StaticText(self, -1, "Setting profiles:")
        # name txt ctrl
        st_name = wx.StaticText(self, -1, "Profile name:")
        self.tc_name = wx.TextCtrl(self, -1, size=(self.tc_width, -1))
        self.tc_name.SetMaxLength(14)
        # buttons
        self.button_new = wx.Button(self, label="New")
        self.button_save = wx.Button(self, label="Save")
        self.button_delete = wx.Button(self, label="Delete")
        self.button_new.Bind(wx.EVT_BUTTON, self.onCreateNewProfile)
        self.button_save.Bind(wx.EVT_BUTTON, self.onSave)
        self.button_delete.Bind(wx.EVT_BUTTON, self.onDeleteProfile)

        # Add elements to the sizer
        self.sizer_profiles.Add(st_choice_profiles, 0, wx.CENTER|wx.ALL, 5)
        self.sizer_profiles.Add(self.choice_profiles, 0, wx.CENTER|wx.ALL, 5)
        self.sizer_profiles.Add(st_name, 0, wx.CENTER|wx.ALL, 5)
        self.sizer_profiles.Add(self.tc_name, 0, wx.CENTER|wx.ALL, 5)
        self.sizer_profiles.Add(self.button_new, 0, wx.CENTER|wx.ALL, 5)
        self.sizer_profiles.Add(self.button_save, 0, wx.CENTER|wx.ALL, 5)
        self.sizer_profiles.Add(self.button_delete, 0, wx.CENTER|wx.ALL, 5) 
开发者ID:hhannine,项目名称:superpaper,代码行数:32,代码来源:gui.py

示例8: sizer_toggle_children

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Choice [as 别名]
def sizer_toggle_children(self, sizer, bool_state, toggle_cb=False):
        for child in sizer.GetChildren():
            if child.IsSizer():
                self.sizer_toggle_children(child.GetSizer(), bool_state)
            else:
                widget = child.GetWindow()
                if (
                    isinstance(widget, wx.TextCtrl) or
                    isinstance(widget, wx.StaticText) or
                    isinstance(widget, wx.Choice) or
                    isinstance(widget, wx.Button) or
                    isinstance(widget, wx.CheckBox) and toggle_cb
                ):
                    widget.Enable(bool_state) 
开发者ID:hhannine,项目名称:superpaper,代码行数:16,代码来源:gui.py

示例9: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Choice [as 别名]
def __init__(self, *args, choices=[], fallbackChoice='', **kwargs):
        wx.Choice.__init__(self, *args, choices=choices, **kwargs)
        self._Choices = choices
        self._Fallback = fallbackChoice 
开发者ID:YoRyan,项目名称:nuxhash,代码行数:6,代码来源:settings.py

示例10: SetValue

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Choice [as 别名]
def SetValue(self, value):
        if value in self._Choices:
            wx.Choice.SetSelection(self, self._Choices.index(value))
        else:
            wx.Choice.SetSelection(self, self._Choices.index(self._Fallback)) 
开发者ID:YoRyan,项目名称:nuxhash,代码行数:7,代码来源:settings.py

示例11: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Choice [as 别名]
def __init__(self, parent, ops=[], *a, **k):
        ops = [[op for op in opset if op.in_toolbar] for opset in ops]
        BTToolBar.__init__(self, parent, ops=ops, *a, **k)
        self.stop_button = self.FindById(STOP_ID)
        self.start_button = self.FindById(START_ID)
        self.RemoveTool(START_ID)
        self.stop_start_position = self.GetToolPos(STOP_ID)

##        self.priority = wx.Choice(parent=self, id=wx.ID_ANY, choices=[_("High"), _("Normal"), _("Low")])
##        self.priority.SetSelection(1)
##        self.AddControl(self.priority)

        self.Realize() 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:15,代码来源:DownloadManager.py

示例12: create_widget

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Choice [as 别名]
def create_widget(self):
        choices = [c[0] for c in self.choices]
        self.widget = wx.Choice(self.parent_window.widget, self.id, choices=choices)
        self.widget.SetSelection(self.selection)
        self.widget.Bind(wx.EVT_LEFT_DOWN, self.on_set_focus) 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:7,代码来源:choice.py

示例13: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Choice [as 别名]
def __init__(self, parent, value, *args, **kwargs):
        numDisplays = wx.Display().GetCount()
        choices = ["Monitor %d" % (i + 1) for i in range(numDisplays)]
        eg.Choice.__init__(self, parent, value, choices, *args, **kwargs) 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:6,代码来源:DisplayChoice.py

示例14: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Choice [as 别名]
def __init__(
        self,
        parent,
        value,
        choices,
        pos=wx.DefaultPosition,
        size=wx.DefaultSize,
        *args,
        **kwargs
    ):
        wx.Choice.__init__(
            self, parent, -1, pos, size, choices, *args, **kwargs
        )
        self.SetValue(value) 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:16,代码来源:Choice.py

示例15: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import Choice [as 别名]
def __init__(
        self,
        parent,
        id=-1,
        pos=wx.DefaultPosition,
        size=wx.DefaultSize,
        style=0,
        validator=wx.DefaultValidator,
        name=wx.ChoiceNameStr,
        value=None
    ):
        """
        :Parameters:
            `value` : int
                The initial port to select (0 = COM1:). The first available
                port will be selected if the given port does not exist or
                no value is given.
        """
        ports = eg.SerialThread.GetAllPorts()
        self.ports = ports
        choices = [("COM%d" % (portnum + 1)) for portnum in ports]
        wx.Choice.__init__(
            self, parent, id, pos, size, choices, style, validator, name
        )
        try:
            portPos = ports.index(value)
        except ValueError:
            portPos = 0
        self.SetSelection(portPos) 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:31,代码来源:SerialPortChoice.py


注:本文中的wx.Choice方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。