We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cb43c4e commit efa9cbdCopy full SHA for efa9cbd
src/Library/demos/Save File/main.py
@@ -0,0 +1,22 @@
1
+import gi
2
+
3
+gi.require_version("Gtk", "4.0")
4
+from gi.repository import Gio, Gtk
5
+import workbench
6
7
+button = workbench.builder.get_object("button")
8
9
10
+def on_output_path_selected(_dialog, result):
11
+ # "save_finish" returns a Gio.File you can write to
12
+ file = _dialog.save_finish(result)
13
+ print(f"Save file to {file.get_path()}")
14
15
16
+def save_file(button):
17
+ dialog = Gtk.FileDialog(initial_name="Workbench.txt")
18
+ dialog.save(workbench.window, None, on_output_path_selected)
19
20
21
+# Handle button click
22
+button.connect("clicked", save_file)
0 commit comments