Skip to content

[Question] How to wait for a dialog to return a value? #40

Answered by hugopl
kojix2 asked this question in Q&A
Discussion options

You must be logged in to vote

GTK is event based, the get_file_path method you wrote will return before the file chooser gets closed, so you need to handle what happens when it closes in the response signal instead, something like call a method file_path_changed(Path) from there, etc... IIRC GTK3 had a version that blocked the execution by creating another event loop internally, this is also possible on GTK4 but if I'm not wrong it requires you to create this new event loop by yourself.

So my suggestion is to embrace the asynchronous behavior of the API.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@kojix2
Comment options

Answer selected by hugopl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #39 on October 04, 2022 15:44.