2016-08-18 109 views
-1

我想在wxpython中創建一個插件並運行到下面的錯誤,任何人都可以幫助理解爲什麼我遇到這個錯誤以及如何解決這個問題?TypeError:__init __()得到了一個意外的關鍵字參數'列'

import wx 
from wx.lib.agw import ultimatelistctrl as ULC 


class TestFrame(wx.App): 
    def __init__(self): 
     wx.App.__init__(self) 
     APPNAME = 'plugin' 
     self.frame = wx.Frame(None, -1, size=wx.Size(600,700), title=APPNAME, style=wx.DEFAULT_FRAME_STYLE) 
     splitter = wx.SplitterWindow(self.frame, -1) 
     splitter.SetMinimumPaneSize(180) 
     panel1 = wx.Panel(splitter, size=wx.Size(-1, 300)) 
     commands_panel = wx.Panel(panel1, -1) 
     package_panel = wx.Panel(commands_panel, -1) 
     self.view_listctrl = ULC.UltimateListCtrl(package_panel, id=-1,columns=2,selectionType=1) 
     package_vbox.Add(self.view_listctrl, 2, wx.EXPAND | wx.ALL, 5) 
     #view_listctrl = ULC.UltimateListCtrl(package_panel, id=-1) 
     itemCount = int('2') 
     for x in range(0,itemCount): 
      view_listctrl.SetItemKind(x, 2 , 1) 

if __name__ == "__main__": 
    app = wx.App(False) 
    frame = TestFrame() 
    app.MainLoop() 

錯誤: -

Traceback (most recent call last): 
    File "listctr.py", line 26, in <module> 
    frame = TestFrame() 
    File "listctr.py", line 15, in __init__ 
    self.view_listctrl = ULC.UltimateListCtrl(package_panel, id=-1,columns=2,selectionType=1) 
TypeError: __init__() got an unexpected keyword argument 'columns' 

回答

1

如果你看一下the documentation for the class's __init__,你可以看到它有沒有keyword argumentcolumns,可是你想傳遞一個:

self.view_listctrl = ULC.UltimateListCtrl(package_panel, id=-1,columns=2,selectionType=1) 

這基本上就是錯誤信息告訴你的。

+0

Ami - 我從'從UIElements import OutputConsole'導入,我可以從哪裏安裝UIElements? – kemosabee

+0

@kemosabee我沒有看到你的問題中的代碼。這是一個新問題嗎?如果是這樣,你可以請開一個新的嗎?這是事情在SO上完成的方式。如果你在這裏下載鏈接,我會很高興看到它。 –

+0

Ami - 好吧我會提出一個新的 – kemosabee

相關問題