PreferencesEditor.Show() does not block on OS X

Tried using the above. However, it does not block so the window immediately disappears.

I confirmed that a window is actually created by blocking the UI via wx.Sleep(5). Of course, it disappears after the block. I tried a local event loop like this:

        app = GetApp()
        eventLoop = GUIEventLoop()
        ea = EventLoopActivator(eventLoop)
        while eventLoop.Pending():
            eventLoop.Dispatch()
        app.ProcessIdle()
        del ea

But I cannot find any examples on how to terminate this event loop and restore the original. The documentation hints that Dialog.ShowModal() does this but cannot find an example.

Help?

There’s no the above.

It’s hard to tell what you’re trying to do without the missing pieces, but could it be as simple as changing Show to ShowModal?

Apologies. I was trying to be brief and assumed too much about people’s familiarity with wx.PreferencesEditor.

PreferencesEditor only has a .Show method. The documentation says it is not a dialog window although it may create one.

Shows what I know. I am indeed not familiar with wx.PreferencesEditor.

If you post a complete (but whittled down), runnable example program, then it will be easier for others to help. Since you mention OS X, I presume it’s working for you on some other platform. Could you show something that works elsewhere but not on MacOS?

Ok. Here is the smallest (72 Lines). I run this inside of PyCharm; The _onShowMe event handler demonstrates the problem; BTW, I have never run this on other platforms other than OS X

PreferencesEditorDemo.py (1.9 KB)

You’re not saving a reference to preferencesEditor. When you exit from _onShowMe, the last reference is lost, and the wx.PreferencesEditor is destroyed.

If you add

    self._preferencesEditor = preferencesEditor

do you still have the problem?

1 Like

Ok, silly me. Does not block (Ok), But the dialog stays visible.

Thank you very much