我们从Python开源项目中,提取了以下9个代码示例,用于说明如何使用wx.CheckListBox()。
def __init__(self, parent, message, caption, choices=[]): wx.Dialog.__init__(self, parent, -1) self.SetTitle(caption) sizer = wx.BoxSizer(wx.VERTICAL) self.message = wx.StaticText(self, -1, message) self.clb = wx.CheckListBox(self, -1, choices=choices) self.chbox = wx.CheckBox(self, -1, 'Select all') self.btns = self.CreateSeparatedButtonSizer(wx.OK | wx.CANCEL) self.Bind(wx.EVT_CHECKBOX, self.EvtChBox, self.chbox) sizer.Add(self.message, 0, wx.ALL | wx.EXPAND, 5) sizer.Add(self.clb, 1, wx.ALL | wx.EXPAND, 5) sizer.Add(self.chbox, 0, wx.ALL | wx.EXPAND, 5) sizer.Add(self.btns, 0, wx.ALL | wx.EXPAND, 5) self.SetSizer(sizer) # self.Fit()
def __init__(self, *args, **kwds): # begin wxGlade: ExtractionDialog.__init__ wx.Dialog.__init__(self, *args, **kwds) self.panel_21 = wx.Panel(self, wx.ID_ANY) self.panel_22 = wx.Panel(self, wx.ID_ANY) self.label_2 = wx.StaticText(self, wx.ID_ANY, _("Extraction Location: ")) self.panel_23 = wx.Panel(self, wx.ID_ANY) self.text_ctrl_outpath = wx.TextCtrl(self, wx.ID_ANY, "") self.panel_24 = wx.Panel(self, wx.ID_ANY) self.button_browse_path = wx.Button(self, wx.ID_ANY, _("Browse")) self.panel_25 = wx.Panel(self, wx.ID_ANY) self.panel_10 = wx.Panel(self, wx.ID_ANY) self.panel_13 = wx.Panel(self, wx.ID_ANY) self.radio_box_selection = wx.RadioBox(self, wx.ID_ANY, _("Selection"), choices=[_("Extract All Highlighted")], majorDimension=1, style=wx.RA_SPECIFY_COLS) self.panel_14 = wx.Panel(self, wx.ID_ANY) self.panel_18 = wx.Panel(self, wx.ID_ANY) self.panel_19 = wx.Panel(self, wx.ID_ANY) self.checklistbox_options = wx.CheckListBox(self, wx.ID_ANY) self.panel_20 = wx.Panel(self, wx.ID_ANY) self.panel_12 = wx.Panel(self, wx.ID_ANY) self.panel_15 = wx.Panel(self, wx.ID_ANY) self.button_extract = wx.Button(self, wx.ID_ANY, _("Extract")) self.panel_16 = wx.Panel(self, wx.ID_ANY) self.button_cancel = wx.Button(self, wx.ID_ANY, _("Cancel")) self.panel_17 = wx.Panel(self, wx.ID_ANY) self.panel_11 = wx.Panel(self, wx.ID_ANY) self.__set_properties() self.__do_layout() self.Bind(wx.EVT_BUTTON, self.button_browse_path_click, self.button_browse_path) self.Bind(wx.EVT_RADIOBOX, self.radio_box_selection_clicked, self.radio_box_selection) self.Bind(wx.EVT_BUTTON, self.button_extract_click, self.button_extract) self.Bind(wx.EVT_BUTTON, self.button_cancel_click, self.button_cancel) # end wxGlade self._InitCheckboxes()
def __init__(self, *args, **kwds): # begin wxGlade: delete.__init__ kwds["style"] = wx.MAXIMIZE | wx.CLOSE_BOX | wx.THICK_FRAME|wx.CAPTION wx.Dialog.__init__(self, *args, **kwds) self.panel_2 = wx.ScrolledWindow(self, -1, style=wx.TAB_TRAVERSAL) self.label_1 = wx.StaticText(self.panel_2, -1, "Specify Class") self.combo_box_1 = wx.ComboBox(self.panel_2, -1, choices=[], style=wx.CB_DROPDOWN | wx.CB_READONLY ) self.combo_box_2 = wx.ComboBox(self.panel_2, -1, choices=["Select Standard", "8", "9", "10"], style=wx.CB_DROPDOWN | wx.CB_READONLY ) self.combo_box_3 = wx.ComboBox(self.panel_2, -1, choices=['Select Division'], style=wx.CB_DROPDOWN | wx.CB_READONLY ) self.static_line_2 = wx.StaticLine(self.panel_2, -1) self.panel_1 = wx.Panel(self.panel_2, -1) self.check_list_box_1 = wx.CheckListBox(self.panel_1, -1, (60, 50), (30,30), ['Admission No Name']) self.check_list_box_2 = wx.CheckListBox(self.panel_1, -1, (60, 50), wx.DefaultSize, []) self.button_close = wx.Button(self.panel_2, -1, "Close") self.button_proceed = wx.Button(self.panel_2, -1, "Proceed") self.__set_properties() self.__do_layout() self.Bind(wx.EVT_COMBOBOX, self.oncombo_year, self.combo_box_1) self.Bind(wx.EVT_COMBOBOX, self.oncombo_class, self.combo_box_2) self.Bind(wx.EVT_COMBOBOX, self.oncombo_div, self.combo_box_3) self.Bind(wx.EVT_CHECKLISTBOX, self.on_check, self.check_list_box_1) self.Bind(wx.EVT_CHECKLISTBOX, self.on_check_2, self.check_list_box_2) self.Bind(wx.EVT_BUTTON, self.on_close, self.button_close) self.Bind(wx.EVT_BUTTON, self.on_proceed, self.button_proceed) self.checkedItems=() self.DB=db_operations() self.load_year() # end wxGlade
def __init__(self, *args, **kwargs): self.keys = kwargs.pop('keys', []) wx.CheckListBox.__init__(self, *args, **kwargs)
def __init__(self, welluid, *args, **kwargs): super(Dialog, self).__init__(*args, **kwargs) self.welluid = welluid self.partitionuid = None self._OM = ObjectManager(self) self.partitionmap = [pttn.uid for pttn in self._OM.list('partition', self.welluid)] partitionchoiceitems = [pttn.name for pttn in self._OM.list('partition', self.welluid)] self.partmap = [] self.partitionchoice = wx.Choice(self) self.partitionchoice.AppendItems(partitionchoiceitems) self.partitionchoice.Bind(wx.EVT_CHOICE, self.on_partition_choice) self.partslistbox = wx.CheckListBox(self) button_sizer = self.CreateButtonSizer(wx.OK | wx.CANCEL) main_sizer = wx.BoxSizer(wx.VERTICAL) main_sizer.Add(self.partitionchoice, proportion=0, flag=wx.EXPAND) main_sizer.Add(self.partslistbox, proportion=1, flag=wx.EXPAND) main_sizer.AddSizer(button_sizer, proportion=0, flag=wx.ALIGN_RIGHT) self.SetSizer(main_sizer) if len(self.partitionmap) == 1: self.set_partitionuid(self.partitionmap[0])
def __init__(self, *args, **kwargs): super(Panel, self).__init__(*args, **kwargs) self._OM = ObjectManager(self) self.welluid = None nb = wx.Notebook(self) self.pages = OrderedDict() self.pages["depth"] = wx.CheckListBox(nb) self.pages["log"] = wx.CheckListBox(nb) self.pages["partition"] = wx.CheckListBox(nb) agwStyle = CT.TR_DEFAULT_STYLE | CT.TR_HIDE_ROOT self.pages["property"] = CT.CustomTreeCtrl(nb, agwStyle=agwStyle) self.depthmap = [] self.idepthmap = {} self.logmap = [] self.ilogmap = {} self.partitionmap = [] self.ipartitionmap = {} self.ipropertymap = OrderedDict() self.pagenames = {} self.pagenames["depth"] = u"Profundidade" self.pagenames["log"] = u"Perfil" self.pagenames["partition"] = u"Partição" self.pagenames["property"] = u"Propriedade" for key in self.pages.iterkeys(): nb.AddPage(self.pages[key], self.pagenames[key]) sizer = wx.BoxSizer() sizer.Add(nb, 1, wx.EXPAND) self.SetSizer(sizer)
def __init__(self, *args, **kwargs): self._uiobj = wx.CheckListBox(*args, **kwargs) self._OM = ObjectManager(self) self.tids = None self.well_uid = None self.index2uid = None
def __init__(self, *args, **kwds): # begin wxGlade: consolidated_report.__init__ kwds["style"] = wx.CAPTION | wx.CLOSE_BOX | wx.MINIMIZE_BOX | wx.FRAME_FLOAT_ON_PARENT wx.Dialog.__init__(self, *args, **kwds) self.panel_1 = wx.Panel(self, -1) self.combo_box_1 = wx.ComboBox(self.panel_1, -1, choices=[], style=wx.CB_DROPDOWN | wx.CB_SIMPLE | wx.CB_DROPDOWN | wx.CB_READONLY) self.combo_box_2 = wx.ComboBox(self.panel_1, -1, choices=["Select Standard", "8", "9", "10"], style=wx.CB_DROPDOWN | wx.CB_SIMPLE | wx.CB_DROPDOWN | wx.CB_READONLY) self.combo_box_3 = wx.ComboBox(self.panel_1, -1, choices=["Select Division"], style=wx.CB_DROPDOWN | wx.CB_SIMPLE | wx.CB_DROPDOWN | wx.CB_READONLY) self.combo_box_4 = wx.ComboBox(self.panel_1, -1, choices=["Select Term","Term1","Term2","Annual"], style=wx.CB_DROPDOWN | wx.CB_SIMPLE | wx.CB_DROPDOWN | wx.CB_READONLY) self.label_1 = wx.StaticText(self.panel_1, -1, "Select What to Include") self.checkbox_1 = wx.CheckBox(self.panel_1, -1, "CE") self.checkbox_2 = wx.CheckBox(self.panel_1, -1, "TE") self.checkbox_3 = wx.CheckBox(self.panel_1, -1, "Total") self.checkbox_4 = wx.CheckBox(self.panel_1, -1, "Grade") self.checkbox_5 = wx.CheckBox(self.panel_1, -1, "CE Total") self.checkbox_6 = wx.CheckBox(self.panel_1, -1, "TE Total") self.checkbox_7 = wx.CheckBox(self.panel_1, -1, "Grand Total") allLoc = ['Select All'] list2=['I Language','Malayalam','English','Hindi','S.S','Physics','Biology','Chemistry','Maths','IT'] self.check_list_box_1 = wx.CheckListBox(self.panel_1, -1, (60, 50), (30,30), allLoc) self.check_list_box_2 = wx.CheckListBox(self.panel_1, -1, (60, 50), wx.DefaultSize, list2) self.button_1 = wx.Button(self.panel_1, -1, "Close") self.button_2 = wx.Button(self.panel_1, -1, "Proceed") self.__set_properties() self.__do_layout() self.Bind(wx.EVT_COMBOBOX, self.oncombo_year, self.combo_box_1) self.Bind(wx.EVT_COMBOBOX, self.oncombo_class, self.combo_box_2) self.Bind(wx.EVT_COMBOBOX, self.oncombo_div, self.combo_box_3) self.Bind(wx.EVT_COMBOBOX, self.oncombo_term, self.combo_box_4) self.Bind(wx.EVT_CHECKLISTBOX, self.on_check, self.check_list_box_1) self.Bind(wx.EVT_CHECKLISTBOX, self.on_check_2, self.check_list_box_2) self.Bind(wx.EVT_BUTTON, self.on_close, self.button_1) self.Bind(wx.EVT_BUTTON, self.on_proceed, self.button_2) self.Bind(wx.EVT_CHECKBOX, self.on_check_ce, self.checkbox_1) self.Bind(wx.EVT_CHECKBOX, self.on_check_te, self.checkbox_2) self.Bind(wx.EVT_CHECKBOX, self.on_check_tota, self.checkbox_3) self.Bind(wx.EVT_CHECKBOX, self.on_check_grade, self.checkbox_4) self.Bind(wx.EVT_CHECKBOX, self.on_check_ce_total, self.checkbox_5) self.Bind(wx.EVT_CHECKBOX, self.on_check_te_total, self.checkbox_6) self.Bind(wx.EVT_CHECKBOX, self.on_check_grand, self.checkbox_7) self.checkedItems=() self.checkedItems_2=[0,1,2,3] self.DB=db_operations() self.Selected_Index=[] self.YEAR='' self.CLASS='' self.DIV='' self.TERM='' self.load_year() # end wxGlade
def __init__(self, *args, **kwds): # begin wxGlade: promote.__init__ kwds["style"] = wx.CAPTION | wx.CLOSE_BOX | wx.MINIMIZE_BOX | wx.SYSTEM_MENU | wx.RESIZE_BORDER | wx.TAB_TRAVERSAL | wx.CLIP_CHILDREN wx.Dialog.__init__(self, *args, **kwds) self.panel_2 = wx.ScrolledWindow(self, -1, style=wx.TAB_TRAVERSAL) self.label_10 = wx.StaticText(self.panel_2, -1, "Current Class Details") self.combo_box_1 = wx.ComboBox(self.panel_2, -1, choices=[], style=wx.CB_DROPDOWN | wx.CB_SIMPLE | wx.CB_DROPDOWN | wx.CB_READONLY) self.combo_box_2 = wx.ComboBox(self.panel_2, -1, choices=["Select Standard", "8", "9", "10"], style=wx.CB_DROPDOWN | wx.CB_SIMPLE | wx.CB_DROPDOWN | wx.CB_READONLY) self.combo_box_3 = wx.ComboBox(self.panel_2, -1, choices=['Select Division'], style=wx.CB_DROPDOWN | wx.CB_SIMPLE | wx.CB_DROPDOWN | wx.CB_READONLY) self.static_line_1 = wx.StaticLine(self.panel_2, -1, style=wx.LI_VERTICAL) self.label_11 = wx.StaticText(self.panel_2, -1, "Promote/Move To") self.combo_box_4 = wx.ComboBox(self.panel_2, -1, choices=[], style=wx.CB_DROPDOWN | wx.CB_SIMPLE | wx.CB_DROPDOWN | wx.CB_READONLY) self.combo_box_5 = wx.ComboBox(self.panel_2, -1, choices=["Select Standard", "8", "9", "10"], style=wx.CB_DROPDOWN | wx.CB_SIMPLE | wx.CB_DROPDOWN | wx.CB_READONLY) self.combo_box_6 = wx.ComboBox(self.panel_2, -1, choices=['Select Division'], style=wx.CB_DROPDOWN | wx.CB_SIMPLE | wx.CB_DROPDOWN | wx.CB_READONLY) self.static_line_2 = wx.StaticLine(self.panel_2, -1) self.panel_1 = wx.Panel(self.panel_2, -1) allLoc = ['Admission No Name'] self.check_list_box_1 = wx.CheckListBox(self.panel_1, -1, (60, 50), (30,30), allLoc) self.check_list_box_2 = wx.CheckListBox(self.panel_1, -1, (60, 50), wx.DefaultSize, []) #self.list_box_2 = wx.ListBox(self.panel_1, -1, choices=[]) #self.list_box_3 = wx.ListBox(self.panel_1, -1, choices=[]) self.button_cancel = wx.Button(self.panel_2, -1, "Close") self.button_proceed = wx.Button(self.panel_2, -1, "Proceed") self.__set_properties() self.__do_layout() self.Bind(wx.EVT_COMBOBOX, self.oncombo_year1, self.combo_box_1) self.Bind(wx.EVT_COMBOBOX, self.oncombo_class1, self.combo_box_2) self.Bind(wx.EVT_COMBOBOX, self.oncombo_div1, self.combo_box_3) self.Bind(wx.EVT_COMBOBOX, self.oncombo_year2, self.combo_box_4) self.Bind(wx.EVT_COMBOBOX, self.oncombo_class2, self.combo_box_5) self.Bind(wx.EVT_COMBOBOX, self.oncombo_div2, self.combo_box_6) self.Bind(wx.EVT_CHECKLISTBOX, self.on_check, self.check_list_box_1) self.Bind(wx.EVT_CHECKLISTBOX, self.on_check_2, self.check_list_box_2) self.Bind(wx.EVT_BUTTON, self.on_cancel, self.button_cancel) self.Bind(wx.EVT_BUTTON, self.on_proceed, self.button_proceed) self.checkedItems=() self.DB=db_operations() self.load_year(self.combo_box_1 ,self.combo_box_2 ,self.combo_box_3 ) self.load_year(self.combo_box_4 ,self.combo_box_5 ,self.combo_box_6 ) # end wxGlade