New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wx.LC_SORT causes list to omit certain column values #906

WhiteRusssian opened this Issue Jun 29, 2018 · 1 comment


None yet
2 participants
Copy link

WhiteRusssian commented Jun 29, 2018

Windows 10:
wxPython 4.0.2 (stock build):
Python 3.6 (32bit, stock build):

When I append items to a sorted ListCtrl (wx.LC_SORT_ASCENDING), certain column values are not displayed / are omitted.

The following sample code demonstrates this problem. Commenting out the wx.LC_SORT property in the list definition solves this issue.

import wx

class Frame(wx.Frame):
    def __init__(self, *args, **kwds):
        kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.SetSize((514, 476))

        self.list = wx.ListCtrl(self, wx.ID_ANY, style=wx.BORDER_NONE | 
            wx.FULL_REPAINT_ON_RESIZE | wx.LC_HRULES | wx.LC_REPORT | 
            wx.LC_SINGLE_SEL| wx.LC_VRULES
            # Comment out the following line to show that list displays
            # correctly if not sorted.
            | wx.LC_SORT_ASCENDING 

        wx.FutureCall(0, self.update_list)

    def __set_properties(self):
        self.list.AppendColumn("T", format=wx.LIST_FORMAT_LEFT, width=-1)
        self.list.AppendColumn("C", format=wx.LIST_FORMAT_LEFT, width=-1)
        self.list.AppendColumn("A", format=wx.LIST_FORMAT_LEFT, width=-1)

    def __do_layout(self):
        sizer = wx.GridSizer(1, 1, 0, 0)
        sizer.Add(self.list, 0, wx.EXPAND, 0)

    def update_list(self):
        outlist = [
            ('Adara Naari', 'Darkstar Security a... Alliance', None), 
            ('Acoundexist', 'The Scope', 'Test'),
            ('ada gustave', 'Royal Amarr Institute', None)
        for r in outlist:
            if r[2] is None:
                r = (r[0], r[1], "-")

class App(wx.App):
    def OnInit(self): = Frame(None, wx.ID_ANY, "")
        return True

if __name__ == "__main__":
    mf = App(0)

This comment has been minimized.

Copy link

RobinD42 commented Oct 9, 2018

Fixed by #1030

@RobinD42 RobinD42 closed this Oct 9, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment