wx.Display.GetFromWindow(self) fails

Using wxPython 3.9.0
The code

f = wx.Display.GetFromWindow(self)

        print( "Monitor: " + str(f) )

always prints 0, no matter which monitor the code is executed on.

There was a report back in 2012: wx.Display behaves weirdly after disconnecting one of displays
which seems very much related and implies that this problem has been around for a while.
I am trying to use this code to reposition my app to an existing screen, in cases where the monitor the app was last run on does not exist or is turned off the next time the app is run.
Similar C++ code does seem to return the correct monitor index.