schanti schul
schanti schul

Reputation: 711

WxPython How to make a Frame behave like a Dialog

How can I make a newly created wx.Frame 'block' all other active frames, same as wx.Dialog does. I want to force a user to make a decision (same as dialog) before letting him use any other background active Frames.

Upvotes: 0

Views: 121

Answers (1)

Mike Driscoll
Mike Driscoll

Reputation: 33071

There is a section in the wxPython migration guide on this topic here:

The gist of it is that you should use wx.WindowDisabler or something like this:

def MakeModal(self, modal=True):
    if modal and not hasattr(self, '_disabler'):
        self._disabler = wx.WindowDisabler(self)
    if not modal and hasattr(self, '_disabler'):
        del self._disabler

Upvotes: 1

Related Questions