Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Francis <santiago.danielfrancis@gmail.com>2012-02-14 11:26:00 (GMT)
committer Daniel Francis <santiago.danielfrancis@gmail.com>2012-02-14 11:26:00 (GMT)
commit6df236b61aa9888a215741cf36fbf394611af8c0 (patch)
treed7ffb4e60ebdc5eef9b0e03ed20a2707e8b5f806
parent55900703dd24650cf4c04263559a0a629f351270 (diff)
Save as .png function
-rwxr-xr-xlybniz.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/lybniz.py b/lybniz.py
index b37cff8..14292eb 100755
--- a/lybniz.py
+++ b/lybniz.py
@@ -318,6 +318,12 @@ class GraphClass:
return (x - self.x_min) * self.canvas_width / (self.x_max - self.x_min)
class LybnizActivity(activity.Activity):
+ def write_file(self, file_path):
+ x, y, w, h = self.graph.drawing_area.get_allocation()
+ pix_buffer = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, False, 8, w, h)
+ pix_buffer.get_from_drawable(self.graph.pix_map, self.graph.pix_map.get_colormap(), 0, 0, 0, 0, w, h)
+ pix_buffer.save(file_path, "png")
+
def parameter_entries_repopulate(self):
# set text in entries for parameters
self.y1_entry.set_text(y1)