Search code examples
pythonobjective-cnswindowpyobjcnsapplication

PYObjC NSWindow is NoneType?


window = NSApplication.sharedApplication().mainWindow()
    window.contentView().addSubview_(chart_view)

The window was made in another section and appears fine but I get this:

: 'NoneType' object has no attribute 'contentView'

Does anyone know why it thinks the window is "NoneType"? Thankyou.


Solution

  • It looks like mainWindow() is returning None, which suggests that there is no active window or something like that.