summaryrefslogtreecommitdiffstats
path: root/subprojects/libhandy/examples/example.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 14:36:24 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 14:36:24 +0000
commit9b6d8e63db85c30007b463e91f91a791969fa83f (patch)
tree0899af51d73c1bf986f73ae39a03c4436083018a /subprojects/libhandy/examples/example.py
parentInitial commit. (diff)
downloadgnome-control-center-upstream.tar.xz
gnome-control-center-upstream.zip
Adding upstream version 1:3.38.4.upstream/1%3.38.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'subprojects/libhandy/examples/example.py')
-rwxr-xr-xsubprojects/libhandy/examples/example.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/subprojects/libhandy/examples/example.py b/subprojects/libhandy/examples/example.py
new file mode 100755
index 0000000..2a6f27a
--- /dev/null
+++ b/subprojects/libhandy/examples/example.py
@@ -0,0 +1,32 @@
+#!/usr/bin/python3
+
+import gi
+
+gi.require_version('Gtk', '3.0')
+from gi.repository import Gtk
+gi.require_version('Handy', '1')
+from gi.repository import Handy
+import sys
+
+
+window = Gtk.Window(title = "Keypad Example with Python")
+vbox = Gtk.Box(orientation = Gtk.Orientation.VERTICAL)
+entry = Gtk.Entry()
+keypad = Handy.Keypad()
+
+vbox.add(entry) # widget to show dialed number
+vbox.add(keypad)
+vbox.set_halign(Gtk.Align.CENTER)
+vbox.set_valign(Gtk.Align.CENTER)
+
+vbox.props.margin = 18
+vbox.props.spacing = 18
+keypad.set_row_spacing(6)
+keypad.set_column_spacing(6)
+
+keypad.set_entry(entry) # attach the entry widget
+
+window.connect("destroy", Gtk.main_quit)
+window.add(vbox)
+window.show_all()
+Gtk.main()