Ritz
Ritz

Reputation: 1253

TypeError: __init__() got an unexpected keyword argument 'columns'

I am trying to create a plugin in wxpython and running into below error,can any one help understand why I am running into this error and how to fix this?

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()

Error:-

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'

Upvotes: 0

Views: 19419

Answers (1)

Ami Tavory
Ami Tavory

Reputation: 76297

If you look at the documentation for the class's __init__, you can see that it has no keyword argument columns, and yet you're trying to pass one:

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

It's basically exactly what the error message is telling you.

Upvotes: 1

Related Questions