summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Godoy Poluceno <victorpoluceno@gmail.com>2010-06-09 16:57:41 -0300
committerVictor Godoy Poluceno <victorpoluceno@gmail.com>2010-06-09 16:57:41 -0300
commita70267f954d6b80ebc649d29844d2cfc23f0f487 (patch)
treeeb66809c97f2c631dc987966845a6c04060f3fb9
parentd2d6224a5a97b96a981c6cfce656d31d4b19704c (diff)
downloadlibchamplain-a70267f954d6b80ebc649d29844d2cfc23f0f487.tar.gz
Add minimal.py and minimal-gtk.py to demos
-rw-r--r--bindings/python/demos/Makefile.am2
-rw-r--r--bindings/python/demos/minimal-gtk.py37
-rw-r--r--bindings/python/demos/minimal.py24
3 files changed, 62 insertions, 1 deletions
diff --git a/bindings/python/demos/Makefile.am b/bindings/python/demos/Makefile.am
index 9811b95..5a0b4e5 100644
--- a/bindings/python/demos/Makefile.am
+++ b/bindings/python/demos/Makefile.am
@@ -1 +1 @@
-EXTRA_DIST= capitals.py animated-marker.py launcher-gtk.py launcher.py polygons.py markers.py
+EXTRA_DIST= capitals.py animated-marker.py launcher-gtk.py launcher.py polygons.py markers.py minimal.py minimal-gtk.py
diff --git a/bindings/python/demos/minimal-gtk.py b/bindings/python/demos/minimal-gtk.py
new file mode 100644
index 0000000..bf120e6
--- /dev/null
+++ b/bindings/python/demos/minimal-gtk.py
@@ -0,0 +1,37 @@
+import gobject
+import gtk
+
+import champlaingtk # must be the first imported
+import champlain
+import clutter
+
+def main():
+ # initialize threads and clutter
+ gobject.threads_init()
+ clutter.init()
+
+ # create the top-level window and quit the main loop when it's closed
+ window = gtk.Window(gtk.WINDOW_TOPLEVEL)
+ window.connect('destroy', gtk.main_quit)
+
+ # create the libchamplain widget and set it's size
+ widget = champlaingtk.ChamplainEmbed()
+ widget.set_size_request(640, 480)
+
+ view = widget.get_view()
+ view.set_property('scroll-mode', champlain.SCROLL_MODE_KINETIC)
+ view.set_property('zoom-level', 5)
+ view.center_on(45.466, -73.75)
+
+ # insert it into the widget you wish
+ window.add(widget)
+
+ # show everything
+ window.show_all()
+
+ # start the main loop
+ gtk.main()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/bindings/python/demos/minimal.py b/bindings/python/demos/minimal.py
new file mode 100644
index 0000000..01e1923
--- /dev/null
+++ b/bindings/python/demos/minimal.py
@@ -0,0 +1,24 @@
+import gobject
+import clutter
+import champlain
+
+def main():
+ gobject.threads_init()
+ clutter.init()
+
+ stage = clutter.Stage(default=True)
+ stage.set_size(800, 600)
+
+ # Create the map view
+ actor = champlain.View()
+ actor.set_size(800, 600)
+ stage.add(actor)
+
+ stage.show()
+ clutter.main()
+
+ actor.destroy()
+
+
+if __name__ == '__main__':
+ main()