Ejemplo n.º 1
0
 def save(self, path):
     (p, ext) = os.path.splitext(path)
     if ext.lower()[1:] == gr.GRAPHIC_GRX:
         gr.begingraphics(path)
         self.draw()
         gr.endgraphics()
     else:
         gr.beginprint(path)
         self.draw()
         gr.endprint()
     self.repaint()
Ejemplo n.º 2
0
 def save(self, path):
     (p, ext) = os.path.splitext(path)
     if ext.lower()[1:] == gr.GRAPHIC_GRX:
         gr.begingraphics(path)
         self.draw()
         gr.endgraphics()
     else:
         gr.beginprint(path)
         self.draw()
         gr.endprint()
     self.repaint()
Ejemplo n.º 3
0
def create_example_graphics_export():
    x = [2 * math.pi * i / 100 for i in range(100)]
    y = [math.sin(c) for c in x]
    gr.begingraphics(GRAPHICS_FILENAME)
    pygr.plot(x, y)
    gr.endgraphics()
    with open(GRAPHICS_FILENAME, "rb") as f:
        graphics_data = f.read()
    base64_encoded_graphics_data = b64encode(graphics_data)
    with open(GRAPHICS_FILENAME, "wb") as f:
        f.write(base64_encoded_graphics_data)
Ejemplo n.º 4
0
 def print_gr(self, filename, *args, **kwargs):
     gr.begingraphics(filename)
     self.draw()
     gr.endgraphics()
Ejemplo n.º 5
0
 def print_gr(self, filename, *args, **kwargs):
     gr.begingraphics(filename)
     self.draw()
     gr.endgraphics()