Python wx.CheckListBox() Examples
The following are 11
code examples of wx.CheckListBox().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
wx
, or try the search function
.
Example #1
Source File: finddlg.py From trelby with GNU General Public License v2.0 | 7 votes |
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)
Example #2
Source File: edit_sizers.py From wxGlade with MIT License | 6 votes |
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()
Example #3
Source File: elecsus_gui.py From ElecSus with Apache License 2.0 | 5 votes |
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()
Example #4
Source File: elecsus_gui.py From ElecSus with Apache License 2.0 | 5 votes |
def __init__(self,parent,mainwin,title,plottype,pos): wx.Dialog.__init__(self,parent,wx.ID_ANY,title,size=(400,600),pos=pos) 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=(120,-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.okbtn = wx.Button(self.win,wx.ID_OK,size=(120,BtnSize)) #self.Bind(wx.EVT_BUTTON, self.OnOK, self.okbtn) self.SetSize(self.selection.GetSize()+(50,50)) self.SetMinSize(self.selection.GetSize()+(50,50)) popup_sizer = wx.BoxSizer(wx.VERTICAL) popup_sizer.Add(self.selection,0,wx.EXPAND|wx.ALL, 7) #popup_sizer.Add((-1,5),1,wx.EXPAND) #popup_sizer.Add(self.okbtn,0,wx.EXPAND) #sz = popup_sizer.GetBestSize() #self.win.SetSize((sz.width+20, sz.height+20)) self.SetSizer(popup_sizer) wx.CallAfter(self.Refresh)
Example #5
Source File: optionsframe.py From youtube-dl-gui with The Unlicense | 5 votes |
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
Example #6
Source File: controlcontainer.py From admin4 with Apache License 2.0 | 5 votes |
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)
Example #7
Source File: check_list_box.py From wxGlade with MIT License | 5 votes |
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)
Example #8
Source File: bug194.py From wxGlade with MIT License | 5 votes |
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
Example #9
Source File: Settings.py From meerk40t with MIT License | 5 votes |
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)
Example #10
Source File: misc.py From trelby with GNU General Public License v2.0 | 4 votes |
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
Example #11
Source File: __init__.py From EventGhost with GNU General Public License v2.0 | 4 votes |
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 )