Python wx.LC_SINGLE_SEL Examples
The following are 9
code examples of wx.LC_SINGLE_SEL().
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: __init__.py From EventGhost with GNU General Public License v2.0 | 7 votes |
def __init__(self, parent, id, evtList, ix, plugin): width = 205 wx.ListCtrl.__init__(self, parent, id, style=wx.LC_REPORT | wx.LC_NO_HEADER | wx.LC_SINGLE_SEL, size = (width, -1)) self.parent = parent self.id = id self.evtList = evtList self.ix = ix self.plugin = plugin self.sel = -1 self.il = wx.ImageList(16, 16) self.il.Add(wx.BitmapFromImage(wx.Image(join(eg.imagesDir, "event.png"), wx.BITMAP_TYPE_PNG))) self.SetImageList(self.il, wx.IMAGE_LIST_SMALL) self.InsertColumn(0, '') self.SetColumnWidth(0, width - 5 - SYS_VSCROLL_X) self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnSelect) self.Bind(wx.EVT_SET_FOCUS, self.OnChange) self.Bind(wx.EVT_LIST_INSERT_ITEM, self.OnChange) self.Bind(wx.EVT_LIST_ITEM_DESELECTED, self.OnChange) self.Bind(wx.EVT_LIST_ITEM_RIGHT_CLICK, self.OnRightClick) self.SetToolTipString(self.plugin.text.toolTip)
Example #2
Source File: namesdlg.py From trelby with GNU General Public License v2.0 | 6 votes |
def __init__(self, parent): wx.ListCtrl.__init__(self, parent, -1, style = wx.LC_REPORT | wx.LC_VIRTUAL | wx.LC_SINGLE_SEL | wx.LC_HRULES | wx.LC_VRULES) self.sex = ["Female", "Male"] self.InsertColumn(0, "Name") self.InsertColumn(1, "Type") self.InsertColumn(2, "Sex") self.SetColumnWidth(0, 120) self.SetColumnWidth(1, 120) # we can't use wx.LIST_AUTOSIZE since this is a virtual control, # so calculate the size ourselves since we know the longest string # possible. w = util.getTextExtent(self.GetFont(), "Female")[0] + 15 self.SetColumnWidth(2, w) util.setWH(self, w = 120*2 + w + 25)
Example #3
Source File: MonitorsCtrl.py From EventGhost with GNU General Public License v2.0 | 6 votes |
def __init__(self, parent, pos, size = wx.DefaultSize): ID = wx.NewId() style = wx.LC_REPORT | wx.LC_VRULES | wx.LC_HRULES | wx.LC_SINGLE_SEL wx.ListCtrl.__init__(self, parent, ID, pos, size, style) mons = [(i[0], i[1], i[2] - i[0], i[3] - i[1]) for i in [j[2] for j in Edm()]] for j, header in enumerate(eg.text.General.monitorsHeader): self.InsertColumn(j, header, wx.LIST_FORMAT_RIGHT) self.SetColumnWidth(j, wx.LIST_AUTOSIZE_USEHEADER) for i, mon in enumerate(mons): self.InsertStringItem(i, str(i + 1)) self.SetStringItem(i, 1, str(mon[0])) self.SetStringItem(i, 2, str(mon[1])) self.SetStringItem(i, 3, str(mon[2])) self.SetStringItem(i, 4, str(mon[3])) rect = self.GetItemRect(0, wx.LIST_RECT_BOUNDS) self.hh = rect[1] #header height self.ih = rect[3] #item height size = self.GetRealSize() self.SetMinSize(size) self.SetSize(size)
Example #4
Source File: DiscoveryPanel.py From OpenPLC_Editor with GNU General Public License v3.0 | 6 votes |
def _init_list_ctrl(self): # Set up list control listID = wx.NewId() self.ServicesList = AutoWidthListCtrl( id=listID, name='ServicesList', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 0), style=wx.LC_REPORT | wx.LC_EDIT_LABELS | wx.LC_SORT_ASCENDING | wx.LC_SINGLE_SEL) self.ServicesList.InsertColumn(0, _('NAME')) self.ServicesList.InsertColumn(1, _('TYPE')) self.ServicesList.InsertColumn(2, _('IP')) self.ServicesList.InsertColumn(3, _('PORT')) self.ServicesList.SetColumnWidth(0, 150) self.ServicesList.SetColumnWidth(1, 150) self.ServicesList.SetColumnWidth(2, 150) self.ServicesList.SetColumnWidth(3, 150) self.ServicesList.SetInitialSize(wx.Size(-1, 300)) self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnItemSelected, id=listID) self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnItemActivated, id=listID)
Example #5
Source File: dnd_list.py From PandasDataFrameGUI with MIT License | 5 votes |
def __init__(self, *arg, **kw): if 'style' in kw and (kw['style']&wx.LC_LIST or kw['style']&wx.LC_REPORT): kw['style'] |= wx.LC_SINGLE_SEL else: kw['style'] = wx.LC_SINGLE_SEL|wx.LC_LIST wx.ListCtrl.__init__(self, *arg, **kw) self.Bind(wx.EVT_LIST_BEGIN_DRAG, self._startDrag) dt = ListDrop(self._insert) self.SetDropTarget(dt)
Example #6
Source File: msgdialog.py From wxGlade with MIT License | 5 votes |
def __init__(self, *args, **kwds): # begin wxGlade: MessageDialog.__init__ kwds["style"] = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER wx.Dialog.__init__(self, *args, **kwds) bmp = compat.wx_ArtProvider_GetBitmap(wx.ART_TIP, wx.ART_MESSAGE_BOX, (48, 48)) self.msg_image = wx.StaticBitmap(self, wx.ID_ANY, bmp) self.msg_list = wx.ListCtrl(self, wx.ID_ANY, style=wx.BORDER_SUNKEN | wx.LC_NO_HEADER | wx.LC_REPORT | wx.LC_SINGLE_SEL) self.OK = wx.Button(self, wx.ID_OK, "") # properties self.SetTitle(_("wxGlade Message")) self.msg_image.SetMinSize((48, 48)) self.OK.SetFocus() self.OK.SetDefault() # layout sizer_1 = wx.BoxSizer(wx.VERTICAL) sizer_2 = wx.BoxSizer(wx.HORIZONTAL) msg_title = wx.StaticText(self, wx.ID_ANY, _("wxGlade Message")) msg_title.SetFont(wx.Font(-1, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, "")) sizer_1.Add(msg_title, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 5) sizer_2.Add(self.msg_image, 0, 0, 0) sizer_2.Add(self.msg_list, 1, wx.EXPAND | wx.LEFT, 10) sizer_1.Add(sizer_2, 1, wx.EXPAND | wx.LEFT | wx.RIGHT, 5) sizer_1.Add(self.OK, 0, wx.ALIGN_RIGHT | wx.ALL, 10) self.SetSizer(sizer_1) self.Layout() self.Centre()
Example #7
Source File: WindowList.py From EventGhost with GNU General Public License v2.0 | 5 votes |
def __init__(self, parent, hwnds): wx.ListCtrl.__init__(self, parent, style=wx.LC_REPORT | wx.LC_SINGLE_SEL) listmix.ListCtrlAutoWidthMixin.__init__(self) imageList = wx.ImageList(16, 16) imageList.Add(GetInternalBitmap("cwindow")) self.AssignImageList(imageList, wx.IMAGE_LIST_SMALL) self.InsertColumn(0, "Program") self.InsertColumn(1, "Name") self.InsertColumn(2, "Class") self.InsertColumn(3, "Handle", wx.LIST_FORMAT_RIGHT) for hwnd in hwnds: imageIdx = 0 icon = GetHwndIcon(hwnd) if icon: imageIdx = imageList.AddIcon(icon) idx = self.InsertImageStringItem( sys.maxint, GetWindowProcessName(hwnd), imageIdx ) self.SetStringItem(idx, 1, GetWindowText(hwnd)) self.SetStringItem(idx, 2, GetClassName(hwnd)) self.SetStringItem(idx, 3, str(hwnd)) for i in range(4): self.SetColumnWidth(i, -2) headerSize = self.GetColumnWidth(i) self.SetColumnWidth(i, -1) labelSize = self.GetColumnWidth(i) if headerSize > labelSize: self.SetColumnWidth(i, headerSize)
Example #8
Source File: configuration_dialogs.py From superpaper with MIT License | 4 votes |
def create_paths_listctrl(self, use_multi_image): if use_multi_image: self.paths_listctrl = wx.ListCtrl(self, -1, size=(-1, -1), style=wx.LC_REPORT # | wx.BORDER_SUNKEN | wx.BORDER_SIMPLE # | wx.BORDER_STATIC # | wx.BORDER_THEME # | wx.BORDER_NONE # | wx.LC_EDIT_LABELS | wx.LC_SORT_ASCENDING # | wx.LC_NO_HEADER # | wx.LC_VRULES # | wx.LC_HRULES # | wx.LC_SINGLE_SEL ) self.paths_listctrl.InsertColumn(0, 'Display', wx.LIST_FORMAT_RIGHT, width=100) self.paths_listctrl.InsertColumn(1, 'Source', width=620) else: # show simpler listing without header if only one wallpaper target self.paths_listctrl = wx.ListCtrl(self, -1, size=(-1, -1), style=wx.LC_REPORT # | wx.BORDER_SUNKEN | wx.BORDER_SIMPLE # | wx.BORDER_STATIC # | wx.BORDER_THEME # | wx.BORDER_NONE # | wx.LC_EDIT_LABELS # | wx.LC_SORT_ASCENDING | wx.LC_NO_HEADER # | wx.LC_VRULES # | wx.LC_HRULES # | wx.LC_SINGLE_SEL ) self.paths_listctrl.InsertColumn(0, 'Source', width=720) # Add the item list to the control self.paths_listctrl.SetImageList(self.il, wx.IMAGE_LIST_SMALL) self.sizer_paths_list.Add(self.paths_listctrl, 1, wx.CENTER|wx.ALL|wx.EXPAND, 5)
Example #9
Source File: ToolsDialog.py From wxGlade with MIT License | 4 votes |
def __init__(self, *args, **kwds): # begin wxGlade: ToolsDialog.__init__ kwds["style"] = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER wx.Dialog.__init__(self, *args, **kwds) self.label = wx.TextCtrl(self, wx.ID_ANY, "") self.primary_bitmap = wx.TextCtrl(self, wx.ID_ANY, "") self.primary_bitmap_button = wx.Button(self, wx.ID_ANY, "...") self.disabled_bitmap = wx.TextCtrl(self, wx.ID_ANY, "") self.disabled_bitmap_button = wx.Button(self, wx.ID_ANY, "...") self.event_handler = wx.TextCtrl(self, wx.ID_ANY, "") self.name = wx.TextCtrl(self, wx.ID_ANY, "") self.help_str = wx.TextCtrl(self, wx.ID_ANY, "") self.id = wx.TextCtrl(self, wx.ID_ANY, "") self.check_radio = wx.RadioBox(self, wx.ID_ANY, "Type", choices=["Normal", "Checkable", "Radio"], majorDimension=1, style=wx.RA_SPECIFY_COLS) self.ok = wx.Button(self, wx.ID_OK, "") self.cancel = wx.Button(self, wx.ID_CANCEL, "") self.move_up = wx.Button(self, wx.ID_ANY, "Up") self.move_down = wx.Button(self, wx.ID_ANY, "Down") self.add = wx.Button(self, wx.ID_ANY, "&Add") self.remove = wx.Button(self, wx.ID_ANY, "&Remove") self.add_sep = wx.Button(self, wx.ID_ANY, "Add Separator") self.items = wx.ListCtrl(self, wx.ID_ANY, style=wx.BORDER_DEFAULT | wx.BORDER_SUNKEN | wx.LC_EDIT_LABELS | wx.LC_REPORT | wx.LC_SINGLE_SEL) self.__set_properties() self.__do_layout() self.Bind(wx.EVT_TEXT, self.update_item, self.label) self.Bind(wx.EVT_TEXT, self.update_item, self.primary_bitmap) self.Bind(wx.EVT_BUTTON, self.move_item_up, self.primary_bitmap_button) self.Bind(wx.EVT_TEXT, self.update_item, self.disabled_bitmap) self.Bind(wx.EVT_BUTTON, self.move_item_up, self.disabled_bitmap_button) self.Bind(wx.EVT_TEXT, self.update_item, self.event_handler) self.Bind(wx.EVT_TEXT, self.update_item, self.name) self.Bind(wx.EVT_TEXT, self.update_item, self.help_str) self.Bind(wx.EVT_TEXT, self.update_item, self.id) self.Bind(wx.EVT_RADIOBOX, self.update_item, self.check_radio) self.Bind(wx.EVT_BUTTON, self.move_item_up, self.move_up) self.Bind(wx.EVT_BUTTON, self.move_item_down, self.move_down) self.Bind(wx.EVT_BUTTON, self.add_item, self.add) self.Bind(wx.EVT_BUTTON, self.remove_item, self.remove) self.Bind(wx.EVT_BUTTON, self.add_separator, self.add_sep) self.Bind(wx.EVT_LIST_END_LABEL_EDIT, self.on_label_edited, self.items) self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.show_item, self.items) # end wxGlade