Python wx.LB_SINGLE Examples

The following are 8 code examples of wx.LB_SINGLE(). 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: bomsaway.py    From Boms-Away with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent, id, title):
        wx.Dialog.__init__(self, parent, id, title)
        self.selection_idx = None
        self.selection_text = None

        vbox = wx.BoxSizer(wx.VERTICAL)
        stline = wx.StaticText(
            self,
            11,
            'Duplicate Component values found!'
            '\n\nPlease select which format to follow:')
        vbox.Add(stline, 0, wx.ALIGN_CENTER|wx.TOP)
        self.comp_list = wx.ListBox(self, 331, style=wx.LB_SINGLE)

        vbox.Add(self.comp_list, 1, wx.ALIGN_CENTER_HORIZONTAL | wx.EXPAND)
        self.SetSizer(vbox)
        self.comp_list.Bind(wx.EVT_LISTBOX_DCLICK, self.on_selection, id=wx.ID_ANY)
        self.Show(True) 
Example #2
Source File: new_properties.py    From wxGlade with MIT License 6 votes vote down vote up
def _on_text_click(self, event):
        if self.deactivated and not self.auto_activated and self.text:
            text_rect = self.text.GetClientRect()
            text_rect.Offset(self.text.Position)
            if text_rect.Contains(event.Position):
                self.toggle_active(active=True)
                return
        event.Skip()

#class ListBoxProperty(ComboBoxProperty):
    #def __init__(self, value="", choices=[], default_value=_DefaultArgument, name=None):
        #self.choices = choices
        #TextProperty.__init__(self, value, False, default_value, name)

    #def create_text_ctrl(self, panel, value):
        #style = wx.LB_SINGLE
        #combo = wx.ListBox( panel, -1, self.value, choices=self.choices, style=style )
        #combo.Bind(wx.EVT_LISTBOX, self.on_combobox)
        ##combo.Bind(wx.EVT_KILL_FOCUS, self.on_kill_focus)
        ##combo.Bind(wx.EVT_CHAR, self.on_char)
        #return combo 
Example #3
Source File: bomsaway.py    From Boms-Away with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent, id, title):
        wx.Dialog.__init__(self, parent, id, title)
        self.selection_idx = None
        self.selection_text = None

        vbox = wx.BoxSizer(wx.VERTICAL)
        stline = wx.StaticText(self, 11, 'Please select from the following components')
        vbox.Add(stline, 0, wx.ALIGN_CENTER|wx.TOP)
        self.comp_list = wx.ListBox(self, 331, style=wx.LB_SINGLE)

        vbox.Add(self.comp_list, 1, wx.ALIGN_CENTER_HORIZONTAL | wx.EXPAND)
        self.SetSizer(vbox)
        self.comp_list.Bind(wx.EVT_LISTBOX, self.on_selection, id=wx.ID_ANY)
        self.Show(True) 
Example #4
Source File: widgets.py    From youtube-dl-gui with The Unlicense 5 votes vote down vote up
def Create(self, parent):
        self.__listbox = ListBoxWithHeaders(parent, style=wx.LB_SINGLE)

        self.__listbox.Bind(wx.EVT_MOTION, self._on_motion)
        self.__listbox.Bind(wx.EVT_LEFT_DOWN, self._on_left_down)

        sizer = wx.BoxSizer()
        sizer.Add(self.__listbox, 1, wx.EXPAND)
        self.SetSizer(sizer)
        return True 
Example #5
Source File: bug194.py    From wxGlade with MIT License 5 votes vote down vote up
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 #6
Source File: TextCtrlAutoComplete.py    From OpenPLC_Editor with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent, choices=None):
        wx.PopupWindow.__init__(self, parent, wx.BORDER_SIMPLE)

        self.ListBox = wx.ListBox(self, -1, style=wx.LB_HSCROLL | wx.LB_SINGLE | wx.LB_SORT)

        choices = [] if choices is None else choices
        self.SetChoices(choices)

        self.ListBox.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
        self.ListBox.Bind(wx.EVT_MOTION, self.OnMotion) 
Example #7
Source File: __init__.py    From EventGhost with GNU General Public License v2.0 4 votes vote down vote up
def Configure(self, location_id = "Antwerp, Belgium", hl=''):

        text=self.text

        dialog = eg.ConfigPanel(self)
        sizer = dialog.sizer
        mySizer = wx.FlexGridSizer(cols=2)

        desc0 = wx.StaticText(dialog, -1, text.LanguageLabel)
        mySizer.Add(desc0, 0,  wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)

        Language = wx.TextCtrl(dialog, -1,hl)
        mySizer.Add(Language, 0, wx.EXPAND|wx.ALL, 5)

        desc1 = wx.StaticText(dialog, -1, text.LocationLabel)
        mySizer.Add(desc1, 0,  wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)

        Location = wx.TextCtrl(dialog, -1,location_id)
        mySizer.Add(Location, 0, wx.EXPAND|wx.ALL, 5)

        desc2 = wx.StaticText(dialog, -1, text.CountriesLabel)
        mySizer.Add(desc2, 0,  wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)

        CountriesEdit = wx.ListBox(dialog, -1, choices=[], style=wx.LB_SINGLE)
        mySizer.Add(CountriesEdit, 0, wx.EXPAND|wx.ALL, 5)
        CountriesEdit.Clear()
        CountryList = pywapi.get_countries_from_google()
        i=0
        while i < len(CountryList):
            CountriesEdit.Append(CountryList[i]['name'])
            i=i+1
        def OnCountrySelect(event):
            CitiesEdit.Clear()
            result = pywapi.get_cities_from_google(str(CountryList[CountriesEdit.GetSelection()]['iso_code']))
            i=0
            while i < len(result):
                 CitiesEdit.Append(result[i]['name'])
                 i=i+1
            Location.SetValue(CitiesEdit.GetStringSelection() + ", " + CountriesEdit.GetStringSelection())
        CountriesEdit.Bind(wx.EVT_LISTBOX, OnCountrySelect)

        desc3 = wx.StaticText(dialog, -1, text.CitiesLabel)
        mySizer.Add(desc3, 0,  wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)

        CitiesEdit = wx.ListBox(dialog, -1, choices=[], style=wx.LB_SINGLE)
        mySizer.Add(CitiesEdit, 0, wx.EXPAND|wx.ALL, 5)
        def OnCitySelect(event):
            Location.SetValue(CitiesEdit.GetStringSelection() + ", " + CountriesEdit.GetStringSelection())
        CitiesEdit.Bind(wx.EVT_LISTBOX, OnCitySelect)

        sizer.Add(mySizer, 1, wx.EXPAND)

        while dialog.Affirmed():
            dialog.SetResult(Location.GetValue(), Language.GetValue()) 
Example #8
Source File: JobInfo.py    From meerk40t with MIT License 4 votes vote down vote up
def __init__(self, *args, **kwds):
        # begin wxGlade: JobInfo.__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((659, 612))
        self.operations_listbox = wx.ListBox(self, wx.ID_ANY, choices=[], style=wx.LB_ALWAYS_SB | wx.LB_SINGLE)
        self.commands_listbox = wx.ListBox(self, wx.ID_ANY, choices=[], style=wx.LB_ALWAYS_SB | wx.LB_SINGLE)
        self.button_job_spooler = wx.BitmapButton(self, wx.ID_ANY, icons8_route_50.GetBitmap())
        self.button_writer_control = wx.Button(self, wx.ID_ANY, _("Start Job"))
        self.button_writer_control.SetBitmap(icons8_laser_beam_52.GetBitmap())
        self.button_writer_control.SetFont(
            wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, 0, "Segoe UI"))

        # Menu Bar
        self.JobInfo_menubar = wx.MenuBar()
        wxglade_tmp_menu = wx.Menu()
        self.menu_autostart = wxglade_tmp_menu.Append(wx.ID_ANY, _("Start Spooler"), "", wx.ITEM_CHECK)
        self.Bind(wx.EVT_MENU, self.on_check_auto_start_controller, id=self.menu_autostart.GetId())
        self.menu_prehome = wxglade_tmp_menu.Append(wx.ID_ANY, _("Home Before"), "", wx.ITEM_CHECK)
        self.Bind(wx.EVT_MENU, self.on_check_home_before, id=self.menu_prehome.GetId())
        self.menu_autohome = wxglade_tmp_menu.Append(wx.ID_ANY, _("Home After"), "", wx.ITEM_CHECK)
        self.Bind(wx.EVT_MENU, self.on_check_home_after, id=self.menu_autohome.GetId())
        self.menu_autobeep = wxglade_tmp_menu.Append(wx.ID_ANY, _("Beep After"), "", wx.ITEM_CHECK)
        self.Bind(wx.EVT_MENU, self.on_check_beep_after, id=self.menu_autobeep.GetId())
        self.JobInfo_menubar.Append(wxglade_tmp_menu, _("Automatic"))

        wxglade_tmp_menu = wx.Menu()
        t = wxglade_tmp_menu.Append(wx.ID_ANY, _("Home"), "")
        self.Bind(wx.EVT_MENU, self.jobadd_home, id=t.GetId())
        t = wxglade_tmp_menu.Append(wx.ID_ANY, _("Wait"), "")
        self.Bind(wx.EVT_MENU, self.jobadd_wait, id=t.GetId())
        t = wxglade_tmp_menu.Append(wx.ID_ANY, _("Beep"), "")
        self.Bind(wx.EVT_MENU, self.jobadd_beep, id=t.GetId())
        t = wxglade_tmp_menu.Append(wx.ID_ANY, _("Interrupt"), "")
        self.Bind(wx.EVT_MENU, self.jobadd_interrupt, id=t.GetId())
        self.JobInfo_menubar.Append(wxglade_tmp_menu, _("Add"))
        self.SetMenuBar(self.JobInfo_menubar)
        # Menu Bar end

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_LISTBOX, self.on_listbox_operation_click, self.operations_listbox)
        self.Bind(wx.EVT_LISTBOX_DCLICK, self.on_listbox_operation_dclick, self.operations_listbox)
        self.Bind(wx.EVT_LISTBOX, self.on_listbox_commands_click, self.commands_listbox)
        self.Bind(wx.EVT_LISTBOX_DCLICK, self.on_listbox_commands_dclick, self.commands_listbox)
        self.Bind(wx.EVT_BUTTON, self.on_button_start_job, self.button_writer_control)
        self.Bind(wx.EVT_BUTTON, self.on_button_job_spooler, self.button_job_spooler)
        # end wxGlade

        self.Bind(wx.EVT_CLOSE, self.on_close, self)

        # TODO: Move this to Elements
        self.preprocessor = OperationPreprocessor()
        self.operations = []