當前位置: 首頁>>代碼示例>>Python>>正文


Python wx.ListBox方法代碼示例

本文整理匯總了Python中wx.ListBox方法的典型用法代碼示例。如果您正苦於以下問題:Python wx.ListBox方法的具體用法?Python wx.ListBox怎麽用?Python wx.ListBox使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在wx的用法示例。


在下文中一共展示了wx.ListBox方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _do_layout

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import ListBox [as 別名]
def _do_layout(self):
    self.SetDoubleBuffered(True)
    self.SetBackgroundColour('#f2f2f2')
    self.SetSize((180, 0))
    self.SetMinSize((180, 0))

    STD_LAYOUT = (0, wx.LEFT | wx.RIGHT | wx.EXPAND, 10)

    container = wx.BoxSizer(wx.VERTICAL)
    container.AddSpacer(15)
    container.Add(wx_util.h1(self, 'Actions'), *STD_LAYOUT)
    container.AddSpacer(5)
    self.listbox = wx.ListBox(self, -1)
    container.Add(self.listbox, 1, wx.LEFT | wx.RIGHT | wx.EXPAND, 10)
    container.AddSpacer(20)
    self.SetSizer(container)

    self.Bind(wx.EVT_LISTBOX, self.selection_change, self.listbox) 
開發者ID:ME-ICA,項目名稱:me-ica,代碼行數:20,代碼來源:sidebar.py

示例2: _do_layout

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import ListBox [as 別名]
def _do_layout(self):
    self.SetDoubleBuffered(True)
    self.SetBackgroundColour('#f2f2f2')
    self.SetSize((180, 0))
    self.SetMinSize((180, 0))

    STD_LAYOUT = (0, wx.LEFT | wx.RIGHT | wx.EXPAND, 10)

    container = wx.BoxSizer(wx.VERTICAL)
    container.AddSpacer(15)
    container.Add(wx_util.h1(self, 'Actions'), *STD_LAYOUT)
    container.AddSpacer(5)
    thing = wx.ListBox(self, -1, choices=self.contents)
    container.Add(thing, 1, wx.LEFT | wx.RIGHT | wx.EXPAND, 10)
    container.AddSpacer(20)
    self.SetSizer(container)
    thing.SetSelection(0)

    self.Bind(wx.EVT_LISTBOX, self.onClick, thing) 
開發者ID:lrq3000,項目名稱:pyFileFixity,代碼行數:21,代碼來源:sidebar.py

示例3: __init__

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import ListBox [as 別名]
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) 
開發者ID:Jeff-Ciesielski,項目名稱:Boms-Away,代碼行數:20,代碼來源:bomsaway.py

示例4: _on_text_click

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import ListBox [as 別名]
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 
開發者ID:wxGlade,項目名稱:wxGlade,代碼行數:23,代碼來源:new_properties.py

示例5: __init__

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import ListBox [as 別名]
def __init__(self, *args, **kwds):
        # begin wxGlade: TemplateListDialog.__init__
        kwds["style"] = wx.DEFAULT_DIALOG_STYLE
        wx.Dialog.__init__(self, *args, **kwds)
        self.template_names = wx.ListBox(self, wx.ID_ANY, choices=[])
        self.template_name = wx.StaticText(self, wx.ID_ANY, _("wxGlade template:\n"))
        self.author = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_READONLY)
        self.description = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_MULTILINE | wx.TE_READONLY)
        self.instructions = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_MULTILINE | wx.TE_READONLY)
        self.btn_open = wx.Button(self, wx.ID_OPEN, "")
        self.btn_edit = wx.Button(self, ID_EDIT, _("&Edit"))
        self.btn_delete = wx.Button(self, wx.ID_DELETE, "")
        self.btn_cancel = wx.Button(self, wx.ID_CANCEL, "")

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_LISTBOX_DCLICK, self.on_open, self.template_names)
        self.Bind(wx.EVT_LISTBOX, self.on_select_template, self.template_names)
        self.Bind(wx.EVT_BUTTON, self.on_open, self.btn_open)
        self.Bind(wx.EVT_BUTTON, self.on_edit, id=ID_EDIT)
        self.Bind(wx.EVT_BUTTON, self.on_delete, self.btn_delete)
        # end wxGlade 
開發者ID:wxGlade,項目名稱:wxGlade,代碼行數:25,代碼來源:templates_ui.py

示例6: SetChoices

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import ListBox [as 別名]
def SetChoices(self, choices):
        max_text_width = 0
        max_text_height = 0

        self.ListBox.Clear()
        for choice in choices:
            self.ListBox.Append(choice)
            w, h = self.ListBox.GetTextExtent(choice)
            max_text_width = max(max_text_width, w)
            max_text_height = max(max_text_height, h)

        itemcount = min(len(choices), MAX_ITEM_SHOWN)
        width = self.Parent.GetSize()[0]
        height = \
            max_text_height * itemcount + \
            LISTBOX_INTERVAL_HEIGHT * max(0, itemcount - 1) + \
            2 * LISTBOX_BORDER_HEIGHT
        if max_text_width + 10 > width:
            height += 15
        size = wx.Size(width, height)
        if wx.Platform == '__WXMSW__':
            size.width -= 2
        self.ListBox.SetSize(size)
        self.SetClientSize(size) 
開發者ID:thiagoralves,項目名稱:OpenPLC_Editor,代碼行數:26,代碼來源:TextCtrlAutoComplete.py

示例7: __init__

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import ListBox [as 別名]
def __init__(self, parent):
        wx.ListBox.__init__(self, parent, -1)

        wx.EVT_LISTBOX(self, self.GetId(), self.OnPageChange)

    # get a list of all the pages 
開發者ID:trelby,項目名稱:trelby,代碼行數:8,代碼來源:cfgdlg.py

示例8: __init__

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import ListBox [as 別名]
def __init__(self, parent, size, data, *args, **kwargs):

        wx.ListBox.__init__(self, parent, size, **kwargs)

        if isinstance(data,(pd.RangeIndex,pd.Int64Index)):
            # RangeIndex is not supported by self._update_columns
            data = pd.Index([str(i) for i in data])
        self.data = data

        self.InsertItems(self.data, 0)

        self.Bind(wx.EVT_LISTBOX, self.on_selection_changed)

        self.Bind(wx.EVT_LEFT_DOWN, self.on_left_down)

        self.Bind(wx.EVT_RIGHT_DOWN, self.on_right_down)
        self.Bind(wx.EVT_RIGHT_UP, self.on_right_up)
        self.Bind(wx.EVT_MOTION, self.on_move)

        self.index_iter = range(len(self.data))

        self.selected_items = [True] * len(self.data)
        self.index_mapping = list(range(len(self.data)))

        self.drag_start_index = None

        self.update_selection()
        self.SetFocus() 
開發者ID:bluenote10,項目名稱:PandasDataFrameGUI,代碼行數:30,代碼來源:dfgui.py

示例9: __init__

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import ListBox [as 別名]
def __init__(self, parent, buildSpec, configPanels, *args, **kwargs):
        super(Sidebar, self).__init__(parent, *args, **kwargs)
        self._parent = parent
        self.buildSpec = buildSpec
        self.configPanels = configPanels
        self.activeSelection = 0
        self.options = list(self.buildSpec['widgets'].keys())
        self.leftPanel = wx.Panel(self)
        self.label = wx_util.h1(self.leftPanel, self.buildSpec.get('sidebar_title'))
        self.listbox = wx.ListBox(self.leftPanel, -1, choices=self.options)
        self.Bind(wx.EVT_LISTBOX, self.swapConfigPanels, self.listbox)
        self.layoutComponent()
        self.listbox.SetSelection(0) 
開發者ID:chriskiehl,項目名稱:Gooey,代碼行數:15,代碼來源:sidebar.py

示例10: getWidget

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import ListBox [as 別名]
def getWidget(self, parent, *args, **options):
        height = self._options.get('height', 60)
        return wx.ListBox(
            parent=parent,
            choices=self._meta['choices'],
            size=(-1, height),
            style=wx.LB_MULTIPLE
        ) 
開發者ID:chriskiehl,項目名稱:Gooey,代碼行數:10,代碼來源:listbox.py

示例11: _remove_prefix

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import ListBox [as 別名]
def _remove_prefix(self, string):
        if string[:len(self.TEXT_PREFIX)] == self.TEXT_PREFIX:
            return string[len(self.TEXT_PREFIX):]
        return string

    # wx.ListBox methods 
開發者ID:MrS0m30n3,項目名稱:youtube-dl-gui,代碼行數:8,代碼來源:widgets.py

示例12: GetString

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import ListBox [as 別名]
def GetString(self, index):
        if index < 0 or index >= self.GetCount():
            # Return empty string based on the wx.ListBox docs
            # for some reason parent GetString does not handle
            # invalid indices
            return ""

        return self._remove_prefix(super(ListBoxWithHeaders, self).GetString(index)) 
開發者ID:MrS0m30n3,項目名稱:youtube-dl-gui,代碼行數:10,代碼來源:widgets.py

示例13: crt_listbox

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import ListBox [as 別名]
def crt_listbox(self, choices, style=None):
        if style is None:
            listbox = wx.ListBox(self, choices=choices, size=self.LISTBOX_SIZE)
        else:
            listbox = wx.ListBox(self, choices=choices, style=style, size=self.LISTBOX_SIZE)

        return listbox 
開發者ID:MrS0m30n3,項目名稱:youtube-dl-gui,代碼行數:9,代碼來源:optionsframe.py

示例14: create_widget

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import ListBox [as 別名]
def create_widget(self):
        choices = [c[0] for c in self.choices]
        self.widget = wx.ListBox(self.parent_window.widget, self.id, choices=choices)
        if self.selection>=0: self.widget.SetSelection(self.selection)
        self.widget.Bind(wx.EVT_LEFT_DOWN, self.on_set_focus) 
開發者ID:wxGlade,項目名稱:wxGlade,代碼行數:7,代碼來源:list_box.py

示例15: __init__

# 需要導入模塊: import wx [as 別名]
# 或者: from wx import ListBox [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


注:本文中的wx.ListBox方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。