Python wx.EVT_CHECKLISTBOX Examples

The following are 6 code examples of wx.EVT_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: elecsus_gui.py    From ElecSus with Apache License 2.0 5 votes vote down vote up
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 #2
Source File: elecsus_gui.py    From ElecSus with Apache License 2.0 5 votes vote down vote up
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 #3
Source File: params.py    From admin4 with Apache License 2.0 5 votes vote down vote up
def __init__(self, parent, value):
        pre = wx.PreDialog()
        g.frame.res.LoadOnDialog(pre, parent, 'DIALOG_CONTENT_CHECKLIST')
        self.PostCreate(pre)
        self.list = xrc.XRCCTRL(self, 'CHECK_LIST')
        # Set list items
        i = 0
        for v,ch in value:
            self.list.Append(v)
            self.list.Check(i, ch)
            i += 1
        self.SetAutoLayout(True)
        self.GetSizer().Fit(self)
        # Callbacks
        self.ID_BUTTON_APPEND = xrc.XRCID('BUTTON_APPEND')
        self.ID_BUTTON_REMOVE = xrc.XRCID('BUTTON_REMOVE')
        self.ID_BUTTON_UP = xrc.XRCID('BUTTON_UP')
        self.ID_BUTTON_DOWN = xrc.XRCID('BUTTON_DOWN')
        wx.EVT_CHECKLISTBOX(self, self.list.GetId(), self.OnCheck)
        wx.EVT_BUTTON(self, self.ID_BUTTON_UP, self.OnButtonUp)
        wx.EVT_BUTTON(self, self.ID_BUTTON_DOWN, self.OnButtonDown)
        wx.EVT_BUTTON(self, self.ID_BUTTON_APPEND, self.OnButtonAppend)
        wx.EVT_BUTTON(self, self.ID_BUTTON_REMOVE, self.OnButtonRemove)
        wx.EVT_UPDATE_UI(self, self.ID_BUTTON_UP, self.OnUpdateUI)
        wx.EVT_UPDATE_UI(self, self.ID_BUTTON_DOWN, self.OnUpdateUI)
        wx.EVT_UPDATE_UI(self, self.ID_BUTTON_REMOVE, self.OnUpdateUI) 
Example #4
Source File: controlcontainer.py    From admin4 with Apache License 2.0 5 votes vote down vote up
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 #5
Source File: ConfigPanel.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def FinishSetup(self):
        self.shown = True
        if self.lines:
            self.AddGrid(self.lines, *self.sizerProps)
        spaceSizer = wx.BoxSizer(wx.HORIZONTAL)
        spaceSizer.Add((2, 2))
        spaceSizer.Add(self.sizer, 1, wx.EXPAND | wx.TOP | wx.BOTTOM, 3)
        spaceSizer.Add((4, 4))
        self.SetSizerAndFit(spaceSizer)

        #self.dialog.FinishSetup()
        def OnEvent(dummyEvent):
            self.SetIsDirty()
        self.Bind(wx.EVT_CHECKBOX, OnEvent)
        self.Bind(wx.EVT_BUTTON, OnEvent)
        self.Bind(wx.EVT_CHOICE, OnEvent)
        self.Bind(wx.EVT_TOGGLEBUTTON, OnEvent)
        self.Bind(wx.EVT_TEXT, OnEvent)
        self.Bind(wx.EVT_RADIOBOX, OnEvent)
        self.Bind(wx.EVT_RADIOBUTTON, OnEvent)
        self.Bind(wx.EVT_TREE_SEL_CHANGED, OnEvent)
        self.Bind(wx.EVT_DATE_CHANGED, OnEvent)
        self.Bind(eg.EVT_VALUE_CHANGED, OnEvent)
        self.Bind(wx.EVT_CHECKLISTBOX, OnEvent)
        self.Bind(wx.EVT_SCROLL, OnEvent)
        self.Bind(wx.EVT_LISTBOX, OnEvent) 
Example #6
Source File: Settings.py    From meerk40t with MIT License 5 votes vote down vote up
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)