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

After dialog's 'OK' response, main gtk window won't change it's window-size with content. #31

Closed
sudipshil9862 opened this issue Feb 23, 2023 · 1 comment

Comments

@sudipshil9862
Copy link
Owner

The reason why the parent.set_default_size(300, 200) line doesn't work when I call dialog.close() immediately after it is because dialog.close() closes the dialog window, as the dialog and its widgets are destroyed and no longer exist...
and if I don't call dialog.close() immediately after parent.set_default_size(300, 200), then the parent.set_default_size(300, 200) code will work because the widgets of the dialog still exist and are still accessible cause the dialog object itself is still alive...

@sudipshil9862
Copy link
Owner Author

sudipshil9862 commented Feb 23, 2023

Solution:
so what I did, I scheduled this dialog.close() code lately so that every operations will be complete before this...GLib.idle_add() schedules the function call to be executed in the main event loop, after all pending events have been processed. I calculated already that the time complexity and this delay should be very negligible. So, dialog will close immediately.
Note:
Have to import from gi.repository import GLib

@sudipshil9862 sudipshil9862 changed the title After dialog's 'OK' response, main gtk window won't change it's size wit content. After dialog's 'OK' response, main gtk window won't change it's window-size with content. Feb 23, 2023
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

1 participant