-
Beta Was this translation helpful? Give feedback.
Answered by
hugopl
Oct 4, 2022
Replies: 1 comment 1 reply
-
GTK is event based, the So my suggestion is to embrace the asynchronous behavior of the API. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
hugopl
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
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 methodfile_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.