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


Python wx.CheckListBox方法代码示例

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


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

示例1: showExtra

# 需要导入模块: import wx [as 别名]
# 或者: from wx import CheckListBox [as 别名]
def showExtra(self, flag):
        self.extraLabel.Show(flag)
        self.elements.Show(flag)

        self.useExtra = flag

        if flag:
            self.moreButton.SetLabel("<<< Less")
            pos = self.elements.GetPosition()

            # don't know of a way to get the vertical spacing of items in
            # a wx.CheckListBox, so estimate it at font height + 5 pixels,
            # which is close enough on everything I've tested.
            h = pos.y + len(self.elementTypes) * \
                (util.getFontHeight(self.elements.GetFont()) + 5) + 15
        else:
            self.moreButton.SetLabel("More >>>")
            h = max(self.extraLabel.GetPosition().y,
                    self.moreButton.GetPosition().y +
                    self.moreButton.GetClientSize().height + 5)

        self.SetSizeHints(self.GetClientSize().width, h)
        util.setWH(self, h = h) 
开发者ID:trelby,项目名称:trelby,代码行数:25,代码来源:finddlg.py

示例2: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import CheckListBox [as 别名]
def __init__(self, parent, title):
        wx.Dialog.__init__(self, parent, -1, title)
        self.sizer = sizer = wx.BoxSizer(wx.VERTICAL)
        self.message = wx.StaticText(self, -1, "")
        sizer.Add(self.message, 0, wx.TOP | wx.LEFT | wx.RIGHT | wx.EXPAND, 10)
        self.choices = wx.CheckListBox(self, -1, choices=[])
        sizer.Add(self.choices, 1, wx.EXPAND | wx.LEFT | wx.RIGHT, 10)
        sizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND | wx.ALL, 10)
        sz2 = wx.BoxSizer(wx.HORIZONTAL)
        sz2.Add(wx.Button(self, wx.ID_OK, ""), 0, wx.ALL, 10)
        sz2.Add(wx.Button(self, wx.ID_CANCEL, ""), 0, wx.ALL, 10)
        sizer.Add(sz2, 0, wx.ALIGN_CENTER)
        self.SetAutoLayout(True)
        self.SetSizer(sizer)
        sizer.Fit(self)
        self.CenterOnScreen() 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:18,代码来源:edit_sizers.py

示例3: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import CheckListBox [as 别名]
def __init__(self,parent,style,mainwin,plottype):
		wx.PopupTransientWindow.__init__(self,parent,style)

		self.mainwin = mainwin
		self.plottype = plottype

		win = wx.Panel(self) #,wx.ID_ANY,pos=(0,0),size=(180,200),style=0)

		self.selection = wx.CheckListBox(win, wx.ID_ANY, choices = OutputPlotTypes, size=(150,-1))#,pos=(0,0))
		#self.win.Bind(wx.EVT_CHECKLISTBOX, self.OnTicked, self.selection)
		self.selection.Bind(wx.EVT_CHECKLISTBOX, self.OnTicked)
		
		if plottype == 'Theory':
			display_curves = self.mainwin.display_theory_curves
		else:
			display_curves = self.mainwin.display_expt_curves

		checked_items = []
		for i in range(len(display_curves)):
			if display_curves[i]:
				checked_items.append(i)
		self.selection.SetChecked(checked_items)

		self.SetSize(self.selection.GetSize()+(10,10))
		self.SetMinSize(self.selection.GetSize()+(10,10))
		
		popup_sizer = wx.BoxSizer(wx.VERTICAL)
		popup_sizer.Add(self.selection,0,wx.ALL, 7)
		
		win.SetSizer(popup_sizer)
		popup_sizer.Fit(win)
		self.Layout() 
开发者ID:jameskeaveney,项目名称:ElecSus,代码行数:34,代码来源:elecsus_gui.py

示例4: crt_checklistbox

# 需要导入模块: import wx [as 别名]
# 或者: from wx import CheckListBox [as 别名]
def crt_checklistbox(self, choices, style=None):
        if style is None:
            checklistbox = wx.CheckListBox(self, choices=choices, size=self.CHECKLISTBOX_SIZE)
        else:
            checklistbox = wx.CheckListBox(self, choices=choices, style=style, size=self.CHECKLISTBOX_SIZE)

        return checklistbox 
开发者ID:MrS0m30n3,项目名称:youtube-dl-gui,代码行数:9,代码来源:optionsframe.py

示例5: _bind

# 需要导入模块: import wx [as 别名]
# 或者: from wx import CheckListBox [as 别名]
def _bind(self, ctlName, evt=None, proc=None):
    if isinstance(ctlName, wx.PyEventBinder): # binding to self
      ctl=super(wx.Window, self)
      proc=evt
      evt=ctlName
    elif isinstance(ctlName, wx.Window):
      ctl=ctlName
    else:
      ctl=self[ctlName]

    if not proc:
      if not isinstance(evt, wx.PyEventBinder):
        proc=evt
        evt=None
      if not proc:
        proc=self.OnCheck

    if not evt:
      if isinstance(ctl, wx.Button):
        evt=wx.EVT_BUTTON
      elif isinstance(ctl, wx.CheckBox):
        evt=wx.EVT_CHECKBOX
      elif isinstance(ctl, wx.CheckListBox):
        evt=wx.EVT_CHECKLISTBOX
      elif isinstance(ctl, wx.RadioButton):
        evt=wx.EVT_RADIOBUTTON
      else:
        evt=wx.EVT_TEXT
        if isinstance(ctl, wx.ComboBox):
          ctl.Bind(wx.EVT_COMBOBOX, proc)
    ctl.Bind(evt, proc) 
开发者ID:andreas-p,项目名称:admin4,代码行数:33,代码来源:controlcontainer.py

示例6: create_widget

# 需要导入模块: import wx [as 别名]
# 或者: from wx import CheckListBox [as 别名]
def create_widget(self):
        choices = [c[0] for c in self.choices]
        self.widget = wx.CheckListBox(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,代码来源:check_list_box.py

示例7: __init__

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

        sizer_1 = wx.GridSizer(2, 3, 0, 0)

        self.list_box_single = wx.ListBox(self, wx.ID_ANY, choices=[_("Listbox wxLB_SINGLE")])
        self.list_box_single.SetSelection(0)
        sizer_1.Add(self.list_box_single, 1, wx.ALL | wx.EXPAND, 5)

        self.list_box_multiple = wx.ListBox(self, wx.ID_ANY, choices=[_("Listbox wxLB_MULTIPLE")], style=wx.LB_MULTIPLE)
        self.list_box_multiple.SetSelection(0)
        sizer_1.Add(self.list_box_multiple, 1, wx.ALL | wx.EXPAND, 5)

        self.list_box_extended = wx.ListBox(self, wx.ID_ANY, choices=[_("Listbox wxLB_EXTENDED")], style=wx.LB_EXTENDED)
        self.list_box_extended.SetSelection(0)
        sizer_1.Add(self.list_box_extended, 1, wx.ALL | wx.EXPAND, 5)

        self.check_list_box_single = wx.CheckListBox(self, wx.ID_ANY, choices=[_("CheckListBox wxLB_SINGLE")], style=wx.LB_SINGLE)
        self.check_list_box_single.SetSelection(0)
        sizer_1.Add(self.check_list_box_single, 1, wx.ALL | wx.EXPAND, 5)

        self.check_list_box_multiple = wx.CheckListBox(self, wx.ID_ANY, choices=[_("CheckListBox wxLB_MULTIPLE")], style=wx.LB_MULTIPLE)
        self.check_list_box_multiple.SetSelection(0)
        sizer_1.Add(self.check_list_box_multiple, 1, wx.ALL | wx.EXPAND, 5)

        self.check_list_box_extended = wx.CheckListBox(self, wx.ID_ANY, choices=[_("CheckListBox wxLB_EXTENDED")], style=wx.LB_EXTENDED)
        self.check_list_box_extended.SetSelection(0)
        sizer_1.Add(self.check_list_box_extended, 1, wx.ALL | wx.EXPAND, 5)

        self.SetSizer(sizer_1)

        self.Layout()
        # end wxGlade

# end of class Frame194 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:41,代码来源:bug194.py

示例8: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import CheckListBox [as 别名]
def __init__(self, *args, **kwds):
        # begin wxGlade: Preferences.__init__
        kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE | wx.FRAME_TOOL_WINDOW | wx.STAY_ON_TOP
        wx.Frame.__init__(self, *args, **kwds)
        Module.__init__(self)
        self.SetSize((412, 183))

        self.checklist_options = wx.CheckListBox(self, wx.ID_ANY,
                                                 choices=[
                                                     "Invert Mouse Wheel Zoom",
                                                     "Print Shutdown",
                                                 ])

        self.radio_units = wx.RadioBox(self, wx.ID_ANY, _("Units"),
                                       choices=[_("mm"), _("cm"), _("inch"), _("mils")],
                                       majorDimension=1,
                                       style=wx.RA_SPECIFY_ROWS)

        from wxMeerK40t import supported_languages
        choices = [language_name for language_code, language_name, language_index in supported_languages]
        self.combo_language = wx.ComboBox(self, wx.ID_ANY, choices=choices, style=wx.CB_DROPDOWN)

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_RADIOBOX, self.on_radio_units, self.radio_units)
        self.Bind(wx.EVT_COMBOBOX, self.on_combo_language, self.combo_language)
        self.Bind(wx.EVT_CHECKLISTBOX, self.on_checklist_settings, self.checklist_options)
        # end wxGlade
        self.Bind(wx.EVT_CLOSE, self.on_close, self) 
开发者ID:meerk40t,项目名称:meerk40t,代码行数:32,代码来源:Settings.py

示例9: addList

# 需要导入模块: import wx [as 别名]
# 或者: from wx import CheckListBox [as 别名]
def addList(self, descr, parent, sizer, items, doBtns, isFirst, pad = 0):
        sizer.Add(wx.StaticText(parent, -1, descr), 0, wx.TOP, pad)

        if doBtns:
            hsizer = wx.BoxSizer(wx.HORIZONTAL)

            if isFirst:
                funcs = [ self.OnSet1, self.OnClear1, self.OnToggle1 ]
            else:
                funcs = [ self.OnSet2, self.OnClear2, self.OnToggle2 ]

            tmp = wx.Button(parent, -1, "Set")
            hsizer.Add(tmp)
            wx.EVT_BUTTON(self, tmp.GetId(), funcs[0])

            tmp = wx.Button(parent, -1, "Clear")
            hsizer.Add(tmp, 0, wx.LEFT, 10)
            wx.EVT_BUTTON(self, tmp.GetId(), funcs[1])

            tmp = wx.Button(parent, -1, "Toggle")
            hsizer.Add(tmp, 0, wx.LEFT, 10)
            wx.EVT_BUTTON(self, tmp.GetId(), funcs[2])

            sizer.Add(hsizer, 0, wx.TOP | wx.BOTTOM, 5)

        tmp = wx.CheckListBox(parent, -1)

        longest = -1
        for i in range(len(items)):
            it = items[i]

            tmp.Append(it.text)
            tmp.Check(i, it.selected)

            if isFirst:
                if longest != -1:
                    if len(it.text) > len(items[longest].text):
                        longest = i
                else:
                    longest = 0

        w = -1
        if isFirst:
            h = len(items)
            if longest != -1:
                w = util.getTextExtent(tmp.GetFont(),
                                       "[x] " + items[longest].text)[0] + 15
        else:
            h = min(10, len(items))

        # don't know of a way to get the vertical spacing of items in a
        # wx.CheckListBox, so estimate it at font height + 5 pixels, which
        # is close enough on everything I've tested.
        h *= util.getFontHeight(tmp.GetFont()) + 5
        h += 5
        h = max(25, h)

        util.setWH(tmp, w, h)
        sizer.Add(tmp, 0, wx.EXPAND)

        return tmp 
开发者ID:trelby,项目名称:trelby,代码行数:63,代码来源:misc.py

示例10: Configure

# 需要导入模块: import wx [as 别名]
# 或者: from wx import CheckListBox [as 别名]
def Configure(self, events = 4 * [True] + 23 * [False], events2 = 8*[True]):
        if isinstance(events, bool): # For compatibility with old version !!!
            events = 4 * [True] + 23 * [False]
            events2 = 8 * [True]
        panel = eg.ConfigPanel(self)
        label_mm = wx.StaticText(panel, -1, self.text.label_mm)
        choices = MM_EVENTS
        eventsCtrl = wx.CheckListBox(
            panel,
            -1,
            choices = choices,
        )
        for i in range(len(events)):
            eventsCtrl.Check(i, events[i])
        label_eg = wx.StaticText(panel, -1, self.text.label_eg)
        choices = (
            self.text.playlistEvtTxt,
            self.text.resAdded[0] % "",
            self.text.resRemoved[0] % "",
            self.text.resNowPlay[0],
            self.text.albumEvtTxt,
            self.text.songEvtTxt,
            self.text.jukeboxEvtTxt,
            self.text.mmIsRunning,
        )
        events2Ctrl = wx.CheckListBox(
            panel,
            -1,
            choices = choices,
        )
        for i in range(len(events2)):
            events2Ctrl.Check(i, events2[i])

        Sizer = wx.FlexGridSizer(2, 2, 1, 10)
        Sizer.AddGrowableRow(1)
        Sizer.AddGrowableCol(0)
        Sizer.AddGrowableCol(1)
        Sizer.Add(label_mm)
        Sizer.Add(label_eg)
        Sizer.Add(eventsCtrl, 1, wx.EXPAND)
        Sizer.Add(events2Ctrl, 1, wx.EXPAND)
        panel.sizer.Add(Sizer,1,wx.EXPAND)

        while panel.Affirmed():
            tmpList = []
            for i in range(len(events)):
                tmpList.append(eventsCtrl.IsChecked(i))
            tmpList2 = []
            for i in range(len(events2)):
                tmpList2.append(events2Ctrl.IsChecked(i))
            panel.SetResult(
                tmpList,
                tmpList2
            ) 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:56,代码来源:__init__.py


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