【问题标题】:wxPython - HyperTreeList Item BackgoundColour doesn't apply to full rowwxPython - HyperTreeList 项目背景颜色不适用于整行
【发布时间】:2021-05-08 14:19:25
【问题描述】:

我正在使用 HyperTreeList rom wxPython 来管理一些数据。

在文档中说这种风格:

wx.TR_FULL_ROW_HIGHLIGHT    
Use this style to have the background colour and the selection highlight extend over the entire horizontal row of the tree control window.

将项目背景颜色应用到整个行。这不会发生在我的机器上。 我在这里错过了什么?

用于测试的示例代码:

import wx
import wx.lib.agw.hypertreelist as HTL

class MyFrame(wx.Frame):

    def __init__(self):
        wx.Frame.__init__(self, None, title="HyperTreeList Demo")

        tree = HTL.HyperTreeList(self, agwStyle= HTL.TR_FULL_ROW_HIGHLIGHT)
        tree.AddColumn("Tree Column", width=200)
        tree.AddColumn("Column 1", width=200, flag=wx.ALIGN_LEFT)
        root = tree.AddRoot("Root")

        parent = tree.AppendItem(root, "First child")
        tree.SetItemText(parent, "Child of root", column=1)
        
        tree.SetItemBackgroundColour(parent, "#AFAFAF") 



# our normal wxApp-derived class, as usual
app = wx.App(redirect=False)
locale = wx.Locale(wx.LANGUAGE_DEFAULT)
frame = MyFrame()
app.SetTopWindow(frame)
frame.Show()
app.MainLoop()

【问题讨论】:

    标签: python python-3.x user-interface wxpython


    【解决方案1】:

    似乎是一个错误 -> https://github.com/wxWidgets/Phoenix/issues/2081 在 hypertreelist.py 中查看我的修复。 我希望它会在下一个版本中得到修复。

    【讨论】:

    • 虽然此链接可能会回答问题,但最好在此处包含答案的基本部分并提供链接以供参考。如果链接页面发生更改,仅链接答案可能会失效。 - From Review
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-06-22
    • 1970-01-01
    • 2021-05-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多