summaryrefslogtreecommitdiff
path: root/python-example/test-introspection.py
blob: be7f142e8d0783a447bdf693d0a851df2df4b9ef (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
#!/usr/bin/env python3

# You can generate python documentation with the following commands:
# g-ir-doc-tool --language Python -o ./html ../libxfce4ui/libxfce4ui-2.0.gir
# yelp ./html/

import gi.repository
# Set the search path to use the newly generated introspection files
gi.require_version('GIRepository', '2.0')
from gi.repository import GIRepository
GIRepository.Repository.prepend_search_path('../libxfce4ui/')
# randomly search for libxfce4util's gir and typelib
GIRepository.Repository.prepend_search_path('/usr/local/share/gir-1.0/')
GIRepository.Repository.prepend_search_path('/usr/local/lib/girepository-1.0/')
# Now import 4ui
gi.require_version('Libxfce4ui', '2.0')
from gi.repository import Libxfce4ui
# and Gtk3
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk

# see if it works
titled_dialog = Libxfce4ui.TitledDialog(subtitle="    Hello Xfce Python Developer!    ")
titled_dialog.connect("delete-event", Gtk.main_quit)
titled_dialog.show()
Gtk.main()