Wxpython 超级卷轴列表索引超出范围问题?

Wxpython 超级卷轴列表索引超出范围问题?,wxpython,Wxpython,当我尝试运行以下代码时。我犯了一个错误 import wx from wx.lib.agw.hypertreelist import HyperTreeList class test(wx.Frame): def __init__(self): wx.Frame.__init__(self, None, -1, title='htl', size=(955,550)) self.CenterOnScreen() self.tree

当我尝试运行以下代码时。我犯了一个错误

import wx
from wx.lib.agw.hypertreelist import HyperTreeList

class test(wx.Frame):

    def __init__(self):

        wx.Frame.__init__(self, None, -1, title='htl', size=(955,550))

        self.CenterOnScreen()

        self.tree = HyperTreeList(self, style =
                                            wx.TR_FULL_ROW_HIGHLIGHT |
wx.TR_HAS_VARIABLE_ROW_HEIGHT)
        # create columns
        self.tree.AddColumn("c1", 120)
        self.tree.AddColumn("c1")
        self.tree.AddColumn("c3", 120)
        self.tree.AddColumn("c4")
        self.tree.AddColumn("c5")
        self.tree.AddColumn("c6")
        self.tree.AddColumn("c7")
        self.tree.AddColumn("c8")
        self.tree.AddColumn("c9")

        root = self.tree.AddRoot("root")
        rc = self.tree.AppendItem(root, "child1")
        rc2 = self.tree.AppendItem(root, "child2")

        gauge = wx.Gauge(self.tree.GetMainWindow(), -1, 100,
style=wx.GA_HORIZONTAL|wx.GA_SMOOTH)
        gauge.SetValue(25)   *#can we add this value over/within gauge
control/window*
        gauge.SetDimensions(100, 100, 100, 20)

        self.tree.SetItemWindow(rc2, gauge, 7)  #here is problem

        self.tree.Expand(root)
    #end def

#end test

class App(wx.App):
    """Application class."""

    def OnInit(self):
        self.frame = test()
        self.frame.Show()
        self.SetTopWindow(self.frame)
        return True

def main():
    app = App()
    app.MainLoop()

if __name__ == '__main__':
    main()
我犯了这个错误

Traceback (most recent call last):
  File "/root/workspace/test/src/test.py", line 61, in <module>
    main()
  File "/root/workspace/test/src/test.py", line 57, in main
    app = App()
  File "/usr/lib/python2.6/site-packages/wx-2.8-gtk2-unicode/wx/_core.py",
line 7974, in __init__
    self._BootstrapApp()
  File "/usr/lib/python2.6/site-packages/wx-2.8-gtk2-unicode/wx/_core.py",
line 7548, in _BootstrapApp
    return _core_.PyApp__BootstrapApp(*args, **kwargs)
  File "/root/workspace/test/src/test.py", line 51, in OnInit
    self.frame = test()
  File "/root/workspace/test/src/test.py", line 39, in __init__
    self.tree.SetItemWindow(rc2, gauge, 7)
  File
"/usr/lib/python2.6/site-packages/wx-2.8-gtk2-unicode/wx/lib/agw/hypertreelist.py",
line 3282, in delegate
    return getattr(self._main_win, method)(*args, **kwargs)
  File
"/usr/lib/python2.6/site-packages/wx-2.8-gtk2-unicode/wx/lib/agw/hypertreelist.py",
line 1414, in SetItemWindow
    item.SetWindow(window, column)
  File
"/usr/lib/python2.6/site-packages/wx-2.8-gtk2-unicode/wx/lib/agw/hypertreelist.py",
line 1055, in SetWindow
    self._wnd[column] = wnd
IndexError: list assignment index out of range
回溯(最近一次呼叫最后一次):
文件“/root/workspace/test/src/test.py”,第61行,在
main()
文件“/root/workspace/test/src/test.py”,第57行,在main中
app=app()
文件“/usr/lib/python2.6/site packages/wx-2.8-gtk2-unicode/wx/_core.py”,
第7974行,在_init中__
self._BootstrapApp()
文件“/usr/lib/python2.6/site packages/wx-2.8-gtk2-unicode/wx/_core.py”,
第7548行,in_BootstrapApp
返回_core_uu.PyApp_uuubootstrapapp(*args,**kwargs)
文件“/root/workspace/test/src/test.py”,第51行,在OnInit中
self.frame=test()
文件“/root/workspace/test/src/test.py”,第39行,在__
self.tree.SetItemWindow(rc2,仪表,7)
文件
“/usr/lib/python2.6/site packages/wx-2.8-gtk2-unicode/wx/lib/agw/hypertreelist.py”,
第3282行,在代理中
返回getattr(self.\u main\u win,method)(*args,**kwargs)
文件
“/usr/lib/python2.6/site packages/wx-2.8-gtk2-unicode/wx/lib/agw/hypertreelist.py”,
第1414行,在SetItemWindow中
item.SetWindow(窗口、列)
文件
“/usr/lib/python2.6/site packages/wx-2.8-gtk2-unicode/wx/lib/agw/hypertreelist.py”,
第1055行,在SetWindow中
self.\u wnd[列]=wnd
索引器:列表分配索引超出范围
我做错了什么

第二,我们可以在仪表控制范围内添加百分比

关于,检查点很少

  • 尝试删除
    wx.TR_FULL_ROW_HIGHLIGHT
  • 尝试从
    self.tree.AddColumn(“c1”,120)
    self.tree.AddColumn(“c3”,120)
    中删除
    ,120

    • 这是一个已知的错误,已在SVN中修复--

      直接下载并在应用程序中使用它,而不是在wx中使用它