[gegl-gtk] Add example showing usage with PyGObject (pygi)
- From: Jon Nordby <jonnor src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl-gtk] Add example showing usage with PyGObject (pygi)
- Date: Wed, 13 Jul 2011 23:07:30 +0000 (UTC)
commit fbae1e2a1b858479d71bd1f20ac2832425f6a90f
Author: Jon Nordby <jononor gmail com>
Date: Thu Jul 14 00:59:44 2011 +0200
Add example showing usage with PyGObject (pygi)
examples/gegl-gtk-python.py | 38 ++++++++++++++++++++++++++++++++++++++
1 files changed, 38 insertions(+), 0 deletions(-)
---
diff --git a/examples/gegl-gtk-python.py b/examples/gegl-gtk-python.py
new file mode 100644
index 0000000..dc6fa4d
--- /dev/null
+++ b/examples/gegl-gtk-python.py
@@ -0,0 +1,38 @@
+
+import sys, os.path
+
+import gi
+from gi.repository import Gegl, GeglGtk2, Gtk
+
+graph_xml = """
+<gegl>
+ <gegl:crop width='512' height='512'/>
+ <gegl:over >
+ <gegl:translate x='30' y='30'/>
+ <gegl:dropshadow radius='1.5' x='3' y='3'/>
+ <gegl:text size='80' color='white'><params>
+ <param name='string'>GEGL GTK</param>
+ </params>
+ </gegl:text>
+ </gegl:over>
+ <gegl:unsharp-mask std-dev='30'/>
+ <gegl:load path='%s'/>
+</gegl>"""
+
+if __name__ == '__main__':
+ if len(sys.argv) != 2:
+ print 'Usage: %s FILE' % sys.argv[0]
+ sys.exit(1)
+
+ file_path = os.path.abspath(sys.argv[1])
+
+ Gegl.init(0,"")
+ node = Gegl.Node.new_from_xml(graph_xml % file_path, "/");
+ view_widget = GeglGtk2.View()
+ view_widget.set_property('node', node.get_children()[-1])
+
+ window = Gtk.Window()
+ window.add(view_widget)
+ window.show_all()
+ Gtk.main()
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]