python类ListCtrl()的实例源码

dfgui.py 文件源码 项目:PandasDataFrameGUI 作者: bluenote10 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
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)
sortlistctrl.py 文件源码 项目:fritzchecksum 作者: mementum 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def InsertColumnMixin(self, col, heading,
                          format=wx.LIST_FORMAT_LEFT, width=-1):
        '''Replaces ListCtrl InsertColumn to keep the ascending/descending sort flags
        sync'ed with column insertion

        The reason to do this: if put on the right hand side of the "base
        classes" list a plain InsertColumn method would not be found and Mixins
        are usually put on the right hand side
        '''
        index = self.InsertColumnOrig(col, heading, format, width)
        if index != -1:
            # Colum insert: Insert a sorting flag in the returned index
            self.sortflags.insert(index, True)
            if self.col >= index:
                # Fix index of last sorted column because we added to the left
                self.col += 1

        return index
sortlistctrl.py 文件源码 项目:fritzchecksum 作者: mementum 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def DeleteColumnMixin(self, col):
        '''Replaces ListCtrl DeleteColumn to keep the ascending/descending sort flags
        sync'ed with column insertion

        The reason to do this: if put on the right hand side of the "base
        classes" list a plain InsertColumn method would not be found and Mixins
        are usually put on the right hand side
        '''
        deleted = self.DeleteColumnOrig(col)
        if deleted:
            self.sortflags.pop(col)
            if self.col == col:
                # Last sorted column ... removed ... invalidate index
                self.col = -1
            elif self.col > col:
                # Keep the index sync'ed, since we removed from the left
                self.col -= 1
wxMain.py 文件源码 项目:opc-rest-api 作者: matzpersson 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
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)
runsnake.py 文件源码 项目:BigBrotherBot-For-UrT43 作者: ptitbigorneau 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
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()
dark_mode.py 文件源码 项目:wxpythoncookbookcode 作者: driscollis 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def darkRowFormatter(listctrl, dark=False):
    """
    Toggles the rows in a ListCtrl or ObjectListView widget. 
    """

    listItems = [listctrl.GetItem(i) for i 
                 in range(listctrl.GetItemCount())]
    for index, item in enumerate(listItems):
        if dark:
            if index % 2:
                item.SetBackgroundColour("Dark Grey")
            else:
                item.SetBackgroundColour("Light Grey")
        else:
            if index % 2:
                item.SetBackgroundColour("Light Blue")
            else:
                item.SetBackgroundColour("Yellow")
        listctrl.SetItem(item)
dnd_list.py 文件源码 项目:PandasDataFrameGUI 作者: bluenote10 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
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)
listmixin.py 文件源码 项目:PandasDataFrameGUI 作者: bluenote10 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def __init__(self, numColumns, preSortCallback = None):
        self.SetColumnCount(numColumns)
        self.preSortCallback = preSortCallback
        list = self.GetListCtrl()
        if not list:
            raise ValueError, "No wx.ListCtrl available"
        list.Bind(wx.EVT_LIST_COL_CLICK, self.__OnColClick, list)
dfgui.py 文件源码 项目:PandasDataFrameGUI 作者: bluenote10 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def _on_right_click(self, event):
        """
        Copies a cell into clipboard on right click. Unfortunately,
        determining the clicked column is not straightforward. This
        appraoch is inspired by the TextEditMixin in:
        /usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode/wx/lib/mixins/listctrl.py
        More references:
        - http://wxpython-users.1045709.n5.nabble.com/Getting-row-col-of-selected-cell-in-ListCtrl-td2360831.html
        - https://groups.google.com/forum/#!topic/wxpython-users/7BNl9TA5Y5U
        - https://groups.google.com/forum/#!topic/wxpython-users/wyayJIARG8c
        """
        if self.HitTest(event.GetPosition()) != wx.NOT_FOUND:
            x, y = event.GetPosition()
            row, flags = self.HitTest((x, y))

            col_locs = [0]
            loc = 0
            for n in range(self.GetColumnCount()):
                loc = loc + self.GetColumnWidth(n)
                col_locs.append(loc)

            scroll_pos = self.GetScrollPos(wx.HORIZONTAL)
            # this is crucial step to get the scroll pixel units
            unit_x, unit_y = self.GetMainWindow().GetScrollPixelsPerUnit()

            col = bisect(col_locs, x + scroll_pos * unit_x) - 1

            value = self.df.iloc[row, col]
            # print(row, col, scroll_pos, value)

            clipdata = wx.TextDataObject()
            clipdata.SetText(str(value))
            wx.TheClipboard.Open()
            wx.TheClipboard.SetData(clipdata)
            wx.TheClipboard.Close()
dfgui.py 文件源码 项目:PandasDataFrameGUI 作者: bluenote10 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def OnGetItemText(self, item, col):
        """
        Implements the item getter for a "virtual" ListCtrl.
        """
        value = self.df.iloc[item, col]
        # print("retrieving %d %d %s" % (item, col, value))
        return str(value)
pySIMskin.py 文件源码 项目:SIMreader 作者: stoic1979 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def __init__(self, parent, ID=-1, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.LC_ICON):
        wx.ListCtrl.__init__(self, parent, ID, pos, size, style)
        self.SetBackgroundColour(backgroundColour)
sortlistctrl.py 文件源码 项目:fritzchecksum 作者: mementum 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def __init__(self):
        self.col = -1  # Keeps a reference to the last sorted column
        self.sortflags = list()  # Keeps asc/desc reference for columns
        self.sortdata = dict()  # Holder for column text for he sort process

        # Assumption: always mixin with ListCtrl - Bind to column header click
        self.Bind(wx.EVT_LIST_COL_CLICK, self.OnColClick, self)

        # Replace ListCtrl.InsertColumn with own method and keep a reference
        setattr(self, 'InsertColumnOrig', self.InsertColumn)
        setattr(self, 'InsertColumn', self.InsertColumnMixin)

        # Replace ListCtrl.DeleteColumn with own method and keep a reference
        setattr(self, 'DeleteColumnOrig', self.DeleteColumn)
        setattr(self, 'DeleteColumn', self.DeleteColumnMixin)
sortlistctrl.py 文件源码 项目:fritzchecksum 作者: mementum 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def __init__(self, *args, **kwargs):
        # *args, **kwargs ensures it can be used with GUI builders unmodified
        wx.ListCtrl.__init__(self, *args, **kwargs)
        ColumnSorterMixinNextGen.__init__(self)
filt.py 文件源码 项目:cebl 作者: idfah 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def initSelectorArea(self):
        self.selectorSizer = wx.BoxSizer(orient=wx.VERTICAL)

        filterListControlBox = widgets.ControlBox(self,
                label='Available Filters', orient=wx.VERTICAL)
        self.filterListBox = wx.ListBox(self, choices=filters.filterChoices.keys(),
                style=wx.LB_SORT | wx.LB_SINGLE)
        filterListControlBox.Add(self.filterListBox, proportion=1,
                flag=wx.ALL | wx.EXPAND, border=10)

        self.pushFilterButton = wx.Button(self, label='Push Filter')
        self.Bind(wx.EVT_BUTTON, self.pushFilter, self.pushFilterButton)
        filterListControlBox.Add(self.pushFilterButton, proportion=0,
                flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10)

        self.selectorSizer.Add(filterListControlBox, proportion=1,
                flag=wx.ALL | wx.EXPAND, border=10)

        chainListControlBox = widgets.ControlBox(self, label='Filter Chain', orient=wx.VERTICAL)
        self.chainListBox = wx.ListBox(self, choices=[], style=wx.LB_SINGLE)
        ##self.chainListBox = wx.ListCtrl(self, style=wx.LC_NO_HEADER | wx.LC_SINGLE_SEL)
        self.Bind(wx.EVT_LISTBOX, self.configFilter, self.chainListBox)
        chainListControlBox.Add(self.chainListBox, proportion=1,
                flag=wx.ALL | wx.EXPAND, border=10)

        #self.configFilterButton = wx.Button(self, label='Configure Filter')
        #self.Bind(wx.EVT_BUTTON, self.configFilter, self.configFilterButton)
        #chainListControlBox.Add(self.configFilterButton, proportion=0,
        #        flag=wx.LEFT | wx.RIGHT | wx.EXPAND, border=10)

        self.popFilterButton = wx.Button(self, label='Pop Filter')
        self.Bind(wx.EVT_BUTTON, self.popFilter, self.popFilterButton)
        chainListControlBox.Add(self.popFilterButton, proportion=0,
                flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10)

        self.selectorSizer.Add(chainListControlBox, proportion=1,
                flag=wx.LEFT | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=10)
app.py 文件源码 项目:pyvmwareclient 作者: wbugbofh 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def __init__(self, parent, ID=wx.ID_ANY, pos=wx.DefaultPosition,
                 size=wx.DefaultSize, style=0):
        wx.ListCtrl.__init__(self, parent, ID, pos, size, style)


########################################################################
dialogos.py 文件源码 项目:pyvmwareclient 作者: wbugbofh 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def __init__(self, *args, **kwds):
        # begin wxGlade: MyFrame.__init__
        wx.Frame.__init__(self, *args, **kwds)
        self.label_5 = wx.StaticText(self, wx.ID_ANY, "Cadena Busqueda:")
        self.text_ctrl_bucar = wx.TextCtrl(self, wx.ID_ANY, "")
        self.button_buscar = wx.Button(self, wx.ID_ANY, "Buscar")
        self.label_6 = wx.StaticText(self, wx.ID_ANY, "total VM: 333")
        self.bitmap_button_1 = wx.BitmapButton(self, wx.ID_ANY, wx.Bitmap("/home/mario/pyvmwareclient/wxglade/recicla.png", wx.BITMAP_TYPE_ANY))
        self.list_ctrl_1 = wx.ListCtrl(self, wx.ID_ANY)

        self.__set_properties()
        self.__do_layout()
        # end wxGlade
pigrow_remote.py 文件源码 项目:Pigrow 作者: Pragmatismo 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def __init__(self, parent, id, pos=(5,635), size=(570,160)):
            wx.ListCtrl.__init__(self, parent, id, size=size, style=wx.LC_REPORT, pos=pos)
            self.InsertColumn(0, 'Device')
            self.InsertColumn(1, 'GPIO')
            self.InsertColumn(2, 'wiring')
            self.InsertColumn(3, 'Currently')
            self.InsertColumn(4, 'info')
            self.SetColumnWidth(0, 150)
            self.SetColumnWidth(1, 75)
            self.SetColumnWidth(2, 100)
            self.SetColumnWidth(3, 100)
            self.SetColumnWidth(4, -1)
pigrow_remote.py 文件源码 项目:Pigrow 作者: Pragmatismo 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def __init__(self, parent, id, pos=(5,10), size=(900,200)):
            wx.ListCtrl.__init__(self, parent, id, size=size, style=wx.LC_REPORT, pos=pos)
            self.InsertColumn(0, 'Line')
            self.InsertColumn(1, 'Enabled')
            self.InsertColumn(2, 'Active')
            self.InsertColumn(3, 'Task')
            self.InsertColumn(4, 'extra args')
            self.InsertColumn(5, 'comment')
            self.SetColumnWidth(0, 100)
            self.SetColumnWidth(1, 75)
            self.SetColumnWidth(2, 75)
            self.SetColumnWidth(3, 650)
            self.SetColumnWidth(4, 500)
            self.SetColumnWidth(5, -1)
pigrow_remote.py 文件源码 项目:Pigrow 作者: Pragmatismo 项目源码 文件源码 阅读 37 收藏 0 点赞 0 评论 0
def __init__(self, parent, id, pos=(5,245), size=(900,200)):
            wx.ListCtrl.__init__(self, parent, id, size=size, style=wx.LC_REPORT, pos=pos)
            self.InsertColumn(0, 'Line')
            self.InsertColumn(1, 'Enabled')
            self.InsertColumn(2, 'every')
            self.InsertColumn(3, 'Task')
            self.InsertColumn(4, 'extra args')
            self.InsertColumn(5, 'comment')
            self.SetColumnWidth(0, 75)
            self.SetColumnWidth(1, 75)
            self.SetColumnWidth(2, 100)
            self.SetColumnWidth(3, 500)
            self.SetColumnWidth(4, 500)
            self.SetColumnWidth(5, -1)
pigrow_remote.py 文件源码 项目:Pigrow 作者: Pragmatismo 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def __init__(self, parent, id, pos=(5,530), size=(900,200)):
            wx.ListCtrl.__init__(self, parent, id, size=size, style=wx.LC_REPORT, pos=pos)
            self.InsertColumn(0, 'Line')
            self.InsertColumn(1, 'Enabled')
            self.InsertColumn(2, 'Time')
            self.InsertColumn(3, 'Task')
            self.InsertColumn(4, 'extra args')
            self.InsertColumn(5, 'comment')
            self.SetColumnWidth(0, 75)
            self.SetColumnWidth(1, 75)
            self.SetColumnWidth(2, 100)
            self.SetColumnWidth(3, 500)
            self.SetColumnWidth(4, 500)
            self.SetColumnWidth(5, -1)
pigrow_remote.py 文件源码 项目:Pigrow 作者: Pragmatismo 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def __init__(self, parent, id, pos=(25, 250), size=(550,200)):
            wx.ListCtrl.__init__(self, parent, id, size=size, style=wx.LC_REPORT, pos=pos)
            self.InsertColumn(0, 'Filename')
            self.InsertColumn(1, 'date modified')
            self.InsertColumn(2, 'age')
            self.InsertColumn(3, 'updated?')
            self.SetColumnWidth(0, 190)
            self.SetColumnWidth(1, 150)
            self.SetColumnWidth(2, 110)
            self.SetColumnWidth(3, 100)
common.py 文件源码 项目:bonsu 作者: bonsudev 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def __init__(self, parent, id, bmpsize=(24,24), size=(180,1)):
        wx.ListCtrl.__init__(self, parent, id, style=wx.LC_REPORT|wx.LC_NO_HEADER|wx.LC_HRULES|wx.SUNKEN_BORDER|wx.LC_SINGLE_SEL, size=(180,1))
        ListCtrlAutoWidthMixin.__init__(self)
        bmpchk = getpipelineok24Bitmap()
        bmpunchk = getpipelineignore24Bitmap()
        CheckListCtrlMixin.__init__(self,check_image=bmpchk,uncheck_image=bmpunchk, imgsz=bmpsize)
test_listctrl.py 文件源码 项目:magic-card-database 作者: drknotter 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def OnInit(self):
        frame = wx.Frame(None, -1, "Hello from wxPython")

        id=wx.NewId()
        self.list=wx.ListCtrl(frame,id,style=wx.LC_REPORT|wx.SUNKEN_BORDER)
        self.list.Show(True)

        self.list.InsertColumn(0,"Data #1")
        self.list.InsertColumn(1,"Data #2")
        self.list.InsertColumn(2,"Data #3")

        # 0 will insert at the start of the list
        pos = self.list.InsertStringItem(0,"hello")
        # add values in the other columns on the same row
        self.list.SetStringItem(pos,1,"world")
        self.list.SetStringItem(pos,2,"!")

        pos = self.list.InsertStringItem(0,"wat")
        self.list.SetStringItem(pos,1,"um")
        self.list.SetStringItem(pos,2,"wha")

        self.itemDataMap = {
            0: ("hello","world","!"),
            1: ("wat","um","wha")
            }

        LCM.ColumnSorterMixin.__init__(self,3)

        frame.Show(True)
        self.SetTopWindow(frame)
        return True
DiscoveryDialog.py 文件源码 项目:beremiz 作者: nucleron 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def __init__(self, parent, id, name, pos=wx.DefaultPosition,
                 size=wx.DefaultSize, style=0):
        wx.ListCtrl.__init__(self, parent, id, pos, size, style, name=name)
        listmix.ListCtrlAutoWidthMixin.__init__(self)
TextCtrlAutoComplete.py 文件源码 项目:beremiz 作者: nucleron 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def SetValueFromSelected(self, selected):
        """
        Sets the wx.TextCtrl value from the selected wx.ListCtrl item.
        Will do nothing if no item is selected in the wx.ListCtrl.
        """
        if selected != "":
            self.SetValue(selected)
        self.DismissListBox()
plglist_plg.py 文件源码 项目:imagepy 作者: Image-Py 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def __init__(self, parent, title, data=[]):
        wx.ListCtrl.__init__(self, parent, style=wx.LC_REPORT|wx.LC_SINGLE_SEL|wx.LC_VIRTUAL)
        self.title, self.data = title, data
        #self.Bind(wx.EVT_LIST_CACHE_HINT, self.DoCacheItems)
        for col, text in enumerate(title):
            self.InsertColumn(col, text)
        self.set_data(data)
shotcut_plg.py 文件源码 项目:imagepy 作者: Image-Py 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def __init__(self, parent, title, data=[]):
        wx.ListCtrl.__init__(self, parent, style=wx.LC_REPORT|wx.LC_SINGLE_SEL|wx.LC_VIRTUAL)
        self.title, self.data = title, data
        #self.Bind(wx.EVT_LIST_CACHE_HINT, self.DoCacheItems)
        for col, text in enumerate(title):
            self.InsertColumn(col, text)
        self.set_data(data)
sms_win.py 文件源码 项目:smartschool 作者: asifkodur 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def __init__(self, parent):
        wx.ListCtrl.__init__(self, parent, -1, style=wx.LC_REPORT | wx.SUNKEN_BORDER)
        CheckListCtrlMixin.__init__(self)
        ListCtrlAutoWidthMixin.__init__(self)
        #wx.ListCtrl.InsertStringItem(
        #
mzGUI_standalone.py 文件源码 项目:multiplierz 作者: BlaisProteomics 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
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()
dark_mode.py 文件源码 项目:wxpythoncookbookcode 作者: driscollis 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def darkMode(self, normalPanelColor):
    """
    Toggles dark mode
    """
    widgets = getWidgets(self)
    panel = widgets[0]
    if normalPanelColor == panel.GetBackgroundColour():
        dark_mode = True
    else:
        dark_mode = False
    for widget in widgets:
        if dark_mode:
            if isinstance(widget, ObjectListView) or isinstance(widget, wx.ListCtrl):
                darkRowFormatter(widget, dark=True)
            widget.SetBackgroundColour("Dark Grey")
            widget.SetForegroundColour("White")
        else:
            if isinstance(widget, ObjectListView) or isinstance(widget, wx.ListCtrl):
                darkRowFormatter(widget)
                widget.SetBackgroundColour("White")
                widget.SetForegroundColour("Black")
                continue
            widget.SetBackgroundColour(wx.NullColour)
            widget.SetForegroundColour("Black")
    self.Refresh()
    return dark_mode


问题


面经


文章

微信
公众号

扫码关注公众号