sudipshil9862 / fonts-compare

fonts rendering and comparing
GNU General Public License v2.0
5 stars 2 forks source link

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

Closed sudipshil9862 closed 1 year ago

sudipshil9862 commented 1 year ago

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 commented 1 year ago

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