【问题标题】:Custom headers organization in ListCtrl or another widget in wxPythonListCtrl 中的自定义标题组织或 wxPython 中的其他小部件
【发布时间】:2012-10-18 21:25:12
【问题描述】:

我已经在 wxPython 中为 ListCtrl 编写了代码:

...
self.list_ctrl = wx.ListCtrl(panel, size=(-1,150), style=wx.LC_REPORT|wx.BORDER_SUNKEN)
self.list_ctrl.InsertColumn(0, 'Name')
self.list_ctrl.InsertColumn(1, 'Old value')
self.list_ctrl.InsertColumn(2, 'New value')
self.list_ctrl.InsertColumn(3, 'Old percent')
self.list_ctrl.InsertColumn(4, 'New percent')
...

但我想获得具有以下标题组织的 ListCtrl(或其他小部件):

我认为使用 ListCtrl 很难解决这个问题,可能是在 wxPython 中使用另一个小部件?

【问题讨论】:

    标签: python user-interface wxpython listctrl


    【解决方案1】:

    正如我在您交叉发布的 wxPython 邮件列表中指出的,ListCtrl 不提供此功能。您可以使用列跨越技术和您自己的排序算法通过 Grid 控件 (wx.grid.Grid) 执行此操作。您可能可以破解 UltimateListCtrl 来执行此操作,因为它是纯 Python 而不是包装的 C++ 对象,但这将是一个不平凡的补丁/破解。

    可能最好的方法是滚动您自己的小部件。 wxPython wiki、wxPython 演示及其邮件列表中有自定义小部件的示例。

    【讨论】:

      【解决方案2】:

      您可以使用 wx.html.HtmlWindow 小部件制作自己的小部件。这是示例链接: http://zetcode.com/wxpython/advanced/.

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2023-03-24
        • 1970-01-01
        • 1970-01-01
        • 2014-03-07
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多