summaryrefslogtreecommitdiffstats
path: root/subprojects/libhandy/examples/example.py
blob: 2a6f27a0bee05c67339644b593f62c1304499e2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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()