我们从Python开源项目中,提取了以下6个代码示例,用于说明如何使用wx.LC_VRULES。
def __init__(self, parent, df, status_bar_callback): wx.ListCtrl.__init__( self, parent, -1, style=wx.LC_REPORT | wx.LC_VIRTUAL | wx.LC_HRULES | wx.LC_VRULES | wx.LB_MULTIPLE ) self.status_bar_callback = status_bar_callback self.df_orig = df self.original_columns = self.df_orig.columns[:] self.current_columns = self.df_orig.columns[:] self.sort_by_column = None self._reset_mask() # prepare attribute for alternating colors of rows self.attr_light_blue = wx.ListItemAttr() self.attr_light_blue.SetBackgroundColour("#D6EBFF") self.Bind(wx.EVT_LIST_COL_CLICK, self._on_col_click) self.Bind(wx.EVT_RIGHT_DOWN, self._on_right_click) self.df = pd.DataFrame({}) # init empty to force initial update self._update_rows() self._update_columns(self.original_columns)
def __init__(self): wx.Frame.__init__(self, parent=None, id=wx.ID_ANY, title='Moogle HTTP to OPC Server', size=(800,600) ) sizer = wx.BoxSizer(wx.VERTICAL) self.row_colours = { 'rest': 'blue', 'opc': 'purple'} ## -- Configure Top Tool bar tb = wx.ToolBar(self, style=TBFLAGS) sizer.Add(tb, 0, wx.EXPAND) tsize = (24,24) tb.SetToolBitmapSize(tsize) tb.Realize() self.list = wx.ListCtrl(self, -1, style=wx.LC_REPORT #| wx.BORDER_SUNKEN #| 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.loadListviewHeader() sizer.Add(self.list, 1, wx.EXPAND) self.SetSizer(sizer) sizer.Layout() self.Bind(wx.EVT_CLOSE, self.onClose)
def __init__( self, parent, id=-1, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.LC_REPORT|wx.LC_VIRTUAL|wx.LC_VRULES|wx.LC_SINGLE_SEL, validator=wx.DefaultValidator, columns=None, name=_("ProfileView"), ): wx.ListCtrl.__init__(self, parent, id, pos, size, style, validator, name) if columns is not None: self.columns = columns self.sortOrder = [ (self.columns[5].defaultOrder, self.columns[5]), ] self.sorted = [] self.CreateControls()
def __init__(self, parent, filetypes, fileLimit = None): wx.Dialog.__init__(self, parent, -1, title = 'Select Input Files', style = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER) self.filetypes = {} self.fileArray = wx.ListCtrl(self, -1, style = wx.LC_REPORT | wx.LC_EDIT_LABELS | wx.LC_HRULES | wx.LC_VRULES) for i, (filetype, ext) in enumerate(filetypes): self.fileArray.InsertColumn(i, filetype) assert filetype not in self.filetypes, "Non-unique file identifiers! %s" % filetype self.filetypes[filetype] = ext self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.getFile, self.fileArray) self.goButton = wx.Button(self, -1, "Use Selected Files") self.Bind(wx.EVT_BUTTON, self.complete, self.goButton) self.Bind(wx.EVT_CLOSE, self.abort) box = wx.BoxSizer(wx.VERTICAL) box.Add(self.fileArray, 1, wx.ALL | wx.EXPAND, 10) box.Add(self.goButton, 0, wx.ALL | wx.EXPAND, 10) self.SetSizerAndFit(box) self.SetSize(wx.Size(1200, 300)) self.Bind(wx.EVT_SIZE, self.resize) for i in range(0, 10): self.fileArray.Append([''] * self.fileArray.GetColumnCount()) self.resize(None) self.CentreOnScreen()
def __init__(self, parent, names, units, curvetypes, datatypes, *args, **kwargs): if 'on_ok_callback' in kwargs: self.on_ok_callback = kwargs.pop('on_ok_callback') else: self.on_ok_callback = None if 'on_cancel_callback' in kwargs: self.on_cancel_callback = kwargs.pop('on_cancel_callback') else: self.on_cancel_callback = None super(Dialog, self).__init__(parent, *args, **kwargs) self.names = names self.units = units self.curvetypes = curvetypes self.datatypes = datatypes self.nrows = len(self.names) style = wx.LC_REPORT | wx.LC_VRULES | wx.LC_HRULES | wx.LC_SINGLE_SEL | ULC.ULC_HAS_VARIABLE_ROW_HEIGHT self.list = ULC.UltimateListCtrl(self, wx.ID_ANY, agwStyle=style) self._fill_list() button_sizer = self.CreateButtonSizer(wx.OK | wx.CANCEL) self.Bind(wx.EVT_BUTTON, self.on_button) vbox = wx.BoxSizer(wx.VERTICAL) vbox.Add(self.list, proportion=1, flag=wx.EXPAND) vbox.Add(button_sizer, flag=wx.ALIGN_RIGHT) self.SetSizerAndFit(vbox) self.SetSize((400, 600)) self.SetTitle(u"Importar como:")
def __init__(self, parent): """Constructor""" wx.Panel.__init__(self, parent, -1, style=wx.WANTS_CHARS) # self.Bind(wx.EVT_BUTTON, self.OnSelectFont, btn) self.list_ctrl = theListCtrl(self, -1, style=wx.LC_REPORT | wx.LC_HRULES | wx.LC_VRULES | wx.SUNKEN_BORDER) st1 = wx.StaticText(self, label=' Cadena Busqueda') self.cadenaBusqueda = wx.TextCtrl(self) btnbusqueda = wx.Button(self, label="Buscar") btnrecargaVM = wx.Button(self, label="Actualizar VM") name_rows = ['Carpeta', 'Nombre', 'IP', 'Estado', 'pregunta', 'Disco Path', 'Sistema', 'Notas', 'uuid'] # cargamos los nombres de los elementos for x in range(len(name_rows)): self.list_ctrl.InsertColumn(x, name_rows[x]) # conexion = conectar_con_vcenter(self, id) self.tabla = [] self.tabla = sacar_listado_capertas(conexion) self.vm_buscados = [] self.cargardatos_en_listctrl(self.tabla) # para la ordenacion--- llama a Getlistctrl self.itemDataMap = self.tabla listmix.ColumnSorterMixin.__init__(self, len(name_rows)) self.list_ctrl.Bind(wx.EVT_LIST_ITEM_SELECTED, self.onItemSelected, self.list_ctrl) # self.list_ctrl.Bind(wx.EVT_CONTEXT_MENU, self.onItemSelected, self.list_ctrl) # Metemos las cosas en le ventana en orden txtcontador = wx.StaticText(self, label='total VM: ' + str(len(self.tabla))) sizer = wx.BoxSizer(wx.VERTICAL) hbox1 = wx.BoxSizer(wx.HORIZONTAL) hbox1.Add(st1, wx.ALL | wx.ALIGN_CENTER, 5) hbox1.Add(self.cadenaBusqueda, wx.ALL | wx.ALIGN_CENTER, 5) hbox1.Add(btnbusqueda, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER, 5) hbox1.Add(btnrecargaVM, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER, 5) hbox1.Add(txtcontador, wx.ALL | wx.ALIGN_CENTER, 5) sizer.Add(hbox1, flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP | wx.ALIGN_CENTER, border=2) self.Bind(wx.EVT_BUTTON, self.busquedadatos, btnbusqueda) self.Bind(wx.EVT_BUTTON, self.recarga_VM, btnrecargaVM) sizer.Add(self.list_ctrl, 1, wx.ALL | wx.EXPAND, 5) self.SetSizer(sizer) # tools for search an debug (to use uncomment the next line, works only linux) # wx.lib.inspection.InspectionTool().Show() # ---------------------------------------------------------------------- # Used by the ColumnSorterMixin, see wx/lib/mixins/listctrl.py