Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with Cancel button of GenericDialog? #504

Closed
WC802 opened this issue Oct 30, 2022 · 4 comments
Closed

Problem with Cancel button of GenericDialog? #504

WC802 opened this issue Oct 30, 2022 · 4 comments

Comments

@WC802
Copy link

WC802 commented Oct 30, 2022

Hi!
I've been trying to use the GenericDialog function but when clicking the Cancel button the following error appears: 'NoneType' object has no attribute 'set_root_widget'.
Reading the function this seems to come from this lines:
self._base_app_instance = None

self._old_root_widget = None

I don't know if I'm using it wrong.
Thank you very much.

@dddomodossola
Copy link
Collaborator

Hello @WC802 ,

I'm unable to reproduce the problem. Can you show me how you use the GenericDialog?
However an usage example is within the widgets_overview_app.py (

self.dialog = gui.GenericDialog(title='Dialog Box', message='Click Ok to transfer content to main page', width='500px')
)
Note that when you call dialog.show you must pass the application instance as argument (
self.dialog.show(self)
).

Have a nice day,
Davide

@WC802
Copy link
Author

WC802 commented Nov 1, 2022

Thank you very much for your answer!
I was able to solve it with the example, which I didn't find earlier.
Also, I was trying to do a widget for error handling to make a warning pop up with a message that the user can dismiss. This is what GenericDialog does, except it has two buttons. Although I managed to add the class myself, was there already a class that did this? I couldn't find it in the documentation. Or a way to remove the button.

@dddomodossola
Copy link
Collaborator

The dialog buttons are 'cancel' and 'conf'. To hide the cancel button you can do:

mydialog.cancel.css_display = 'none'

@WC802
Copy link
Author

WC802 commented Nov 2, 2022

Thank you very much for answering so fast!

@WC802 WC802 closed this as completed Nov 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants