Embedded dialog-like behavior in a Panel/Window

Hi Guys,

This might end up to be trivial but I currently have a black-out and cannot figure out how to make a dialog-like behavior in wx.Panel. Basically, I want to create a menu item that when clicked it should create a OK/Cancel button and waits for the user to click OK/Cancel before carrying on with other script tasks in the menu item event. So the behavior I need is like a modal dialog that blocks script flow until it is dismissed. Other windows may or may not be blocked but better if they are not. I can probably do a dirty workaround but I feel there has to be a simple clean way.

Any tips?

Thanks,

Emad

Modal dialogs will always block the rest of the UI. That’s how they work. What you want is a MessageDialog. See http://wxpython.org/Phoenix/docs/html/MessageDialog.html or http://zetcode.com/wxpython/dialogs/ for more information.

Mike

···

On Friday, May 20, 2016 at 1:17:33 PM UTC-5, Emad Dlala wrote:

Hi Guys,

This might end up to be trivial but I currently have a black-out and cannot figure out how to make a dialog-like behavior in wx.Panel. Basically, I want to create a menu item that when clicked it should create a OK/Cancel button and waits for the user to click OK/Cancel before carrying on with other script tasks in the menu item event. So the behavior I need is like a modal dialog that blocks script flow until it is dismissed. Other windows may or may not be blocked but better if they are not. I can probably do a dirty workaround but I feel there has to be a simple clean way.

Any tips?

Thanks,

Emad

No, I don’t want a separate UI popping up. I want my OK/Cancel buttons embedded into an existing window. Message dialog creates a new UI which I don’t want

···

On Friday, May 20, 2016, Mike Driscoll kyosohma@gmail.com wrote:

On Friday, May 20, 2016 at 1:17:33 PM UTC-5, Emad Dlala wrote:

Hi Guys,

This might end up to be trivial but I currently have a black-out and cannot figure out how to make a dialog-like behavior in wx.Panel. Basically, I want to create a menu item that when clicked it should create a OK/Cancel button and waits for the user to click OK/Cancel before carrying on with other script tasks in the menu item event. So the behavior I need is like a modal dialog that blocks script flow until it is dismissed. Other windows may or may not be blocked but better if they are not. I can probably do a dirty workaround but I feel there has to be a simple clean way.

Any tips?

Thanks,

Emad

Modal dialogs will always block the rest of the UI. That’s how they work. What you want is a MessageDialog. See http://wxpython.org/Phoenix/docs/html/MessageDialog.html or http://zetcode.com/wxpython/dialogs/ for more information.

Mike

You received this message because you are subscribed to the Google Groups “wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

If you don’t want to use the widgets that are pre-made, then you’ll have to reinvent the wheel yourself so that it does what you want. This is not built-in.

Mike

···

On Friday, May 20, 2016 at 2:04:41 PM UTC-5, Emad Dlala wrote:

No, I don’t want a separate UI popping up. I want my OK/Cancel buttons embedded into an existing window. Message dialog creates a new UI which I don’t want

Are you aware of yourpanel.MakeModal() ? See the docs:
MakeModal(self, modal=True)

Disables all other windows in the application so that the user can only
interact with this window. Passing False will reverse this effect.

Maybe you can use that to get what you want. I am not sure this is a good
UX idea, though. It breaks conventions/expectations.

···

On Fri, May 20, 2016 at 3:04 PM, Emad Dlala <emad.dlala@gmail.com> wrote:

No, I don't want a separate UI popping up. I want my OK/Cancel buttons
embedded into an existing window. Message dialog creates a new UI which I
don't want