【发布时间】: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