wxPython Frame Class Errors

import wx
import wx.dataview as dv
    
class ExMain(wx.Frame):


    cnx = None
    index = 0

    def __init__(self):

        wx.Frame.__init__(self, wx.ID_ANY, "Title", wx.DefaultPosition, (400,400), wx.DEFAULT_FRAME_STYLE, "Simulator Main")

if __name__ == '__main__':
    app = wx.App()
    frame = NRTSimMain().Show()
    app.MainLoop()

When I run this I am getting the following errors:

frame = NRTSimMain().Show()
File ".\NRTSim-Main.py", line 13, in __init__
wx.Frame.__init__(self, wx.ID_ANY, "Title", wx.DefaultPosition, (350,200), wx.DEFAULT_FRAME_STYLE, "NRT Sorter Sim Main")

TypeError: Frame(): arguments did not match any overloaded call:
overload 1: too many arguments
overload 2: argument 1 has unexpected type 'StandardID'

I have tried myriad overloads with no avail. I really just want to dictate the initial size and position. This Frame is the default for the App.

You didn’t pass a parent parameter to wx.Frame.__init__. It can be None for top-level windows, but it is required.

Isn’t that the ‘self’ parameter being the highest level visual object in the class.

Nope. On that line self is this frame instance, not the parent window that it should be a child of. When you invoke the unbound wx.Frame.__init__ then you need to explicitly pass the object reference that is the instance of the class itself, aka self. It is not implicitly passed for you.

So do I have to specifically state the parent parameter=self?

No, just add an extra parameter, like this:

    def __init__(self):
        wx.Frame.__init__(self, None, wx.ID_ANY, "Title", wx.DefaultPosition, (400,400), wx.DEFAULT_FRAME_STYLE, "Simulator Main")

After making my code look like your example I am seeing failure on execution I don’t understand:

Traceback (most recent call last):
File “.\Simulator-mysql.py”, line 7, in
self.panel = wx.Panel(self, wx.ID_ANY)
NameError: name ‘self’ is not defined

Please show your code.

My apologies, I figured it out. I am relatively new to Python/wx & struggle with indentation. I used a beautify tool that jammed some stuff together and caused some headaches. After painstakingly combing line by line to ensure indetation is correct, all the problems went away. Now I am trying to use sizers with a combination of components, such as textCtrl’s and gridview stuff. When I put a grid view into a stack of horizontal sizer boxes into a vertical sizer box, if one of the horizontals is the listctrl, I’m having trouble making the listCtrl show up with enought size to see things inside.