本文整理汇总了Python中wx.EVT_LISTBOX属性的典型用法代码示例。如果您正苦于以下问题:Python wx.EVT_LISTBOX属性的具体用法?Python wx.EVT_LISTBOX怎么用?Python wx.EVT_LISTBOX使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类wx
的用法示例。
在下文中一共展示了wx.EVT_LISTBOX属性的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _do_layout
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_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)
示例2: _do_layout
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_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)
示例3: _on_text_click
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_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
示例4: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_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
示例5: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_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
示例6: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_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()
示例7: on_left_down
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_LISTBOX [as 别名]
def on_left_down(self, event):
if self.HitTest(event.GetPosition()) != wx.NOT_FOUND:
index = self.HitTest(event.GetPosition())
self.selected_items[index] = not self.selected_items[index]
# doesn't really work to update selection direclty (focus issues)
# instead we wait for the EVT_LISTBOX event and fix the selection
# there...
# self.update_selection()
# TODO: we could probably use wx.CallAfter
event.Skip()
示例8: swap
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_LISTBOX [as 别名]
def swap(self, i, j):
self.index_mapping[i], self.index_mapping[j] = self.index_mapping[j], self.index_mapping[i]
self.SetString(i, self.data[self.index_mapping[i]])
self.SetString(j, self.data[self.index_mapping[j]])
self.selected_items[i], self.selected_items[j] = self.selected_items[j], self.selected_items[i]
# self.update_selection()
# print("Updated mapping:", self.index_mapping)
new_event = wx.PyCommandEvent(wx.EVT_LISTBOX.typeId, self.GetId())
self.GetEventHandler().ProcessEvent(new_event)
示例9: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_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)
示例10: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_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, '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)
示例11: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_LISTBOX [as 别名]
def __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition,
size=wx.DefaultSize, choices=[], style=0, validator=wx.DefaultValidator, name=NAME):
super(ListBoxWithHeaders, self).__init__(parent, id, pos, size, [], style, validator, name)
self.__headers = set()
# Ignore all key events i'm bored to handle the header selection
self.Bind(wx.EVT_KEY_DOWN, lambda event: None)
# Make sure that a header is never selected
self.Bind(wx.EVT_LISTBOX, self._on_listbox)
for event in self.EVENTS:
self.Bind(event, self._disable_header_selection)
# Append the items in our own way in order to add the TEXT_PREFIX
self.AppendItems(choices)
示例12: FinishSetup
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_LISTBOX [as 别名]
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)
示例13: Configure
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_LISTBOX [as 别名]
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())
示例14: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_LISTBOX [as 别名]
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 = []