ListBox gives error on creation?

import wx

class ListerBox(wx.Frame):
    def __init__(self,title):
        super().__init__(parent=None, title=title, size=(500,500))
        panel=wx.Panel
        
        mylist=['a','b','c','d']
        conter=wx.ListBox(panel, -1, (50,50),(50,50),mylist,wx.LB_SINGLE)

when I remove the second line error dissapears, I also watched youtube and did it exactly as they did it
I get this error

Traceback (most recent call last):
File “C:\Users<username>\Desktop\a python files\wxTests.py”, line 22, in
ListerBox = ListerBox(“WxPython Tutorial”)
File “C:\Users<username>\Desktop\a python files\wxTests.py”, line 10, in init
conter=wx.ListBox(panel, -1, (50,50),(50,50),mylist,wx.LB_SINGLE)
TypeError: ListBox(): arguments did not match any overloaded call:
overload 1: too many arguments
overload 2: argument 1 has unexpected type ‘sip.wrappertype’

I hope someone here can lend me a hand, thanks in advance!

Hi,

The statement panel=wx.Panel just assigns the Panel class to the variable panel. You need to assign an instance of the class.

e.g.

panel = wx.Panel(self, -1)
1 Like

Thank you friend, I didnt notice that mistake, its working now, have a pleasant day/night