need help with export_to_png

58 views
Skip to first unread message

Ameya Nanivadekar

unread,
Feb 12, 2016, 2:26:40 AM2/12/16
to Kivy users support
I'm trying to use the export_to_png() method to export a widget to a png file after I am finished drawing on the canvas. The canvas is supposed to have multiple lines and after completing all the lines I would like to save the entire canvas to a png file. Currently if I call export_to_png() after all the drawings are done (button trigger) then I get the following error. 

 File "C:\Program Files (x86)\Python27\lib\site-packages\kivy\uix\widget.py", line 608, in export_to_png
     fbo = Fbo(size=self.size, with_stencilbuffer=True)
   File "kivy\graphics\fbo.pyx", line 148, in kivy.graphics.fbo.Fbo.__init__ (kivy\graphics\fbo.c:3090)
   File "kivy\graphics\instructions.pyx", line 750, in kivy.graphics.instructions.RenderContext.__init__ (kivy\graphics\instructions.c:10606)
   File "kivy\graphics\shader.pyx", line 184, in kivy.graphics.shader.Shader.__init__ (kivy\graphics\shader.c:3832)
   File "kivy\graphics\shader.pyx", line 687, in kivy.graphics.shader.Shader.vs.__set__ (kivy\graphics\shader.c:10892)
   File "kivy\graphics\shader.pyx", line 549, in kivy.graphics.shader.Shader.build_vertex (kivy\graphics\shader.c:8775)
   File "kivy\graphics\shader.pyx", line 579, in kivy.graphics.shader.Shader.link_program (kivy\graphics\shader.c:9214)
 Exception: Shader didnt link, check info log.

This is the line I use to call export_to_png from the on_press function:

self.get_parent_window().children[0].ids['drawingArea'].export_to_png()  # --> produces shader error


However, if I call export_to_png after each individual line is drawn, this error does not come up. This isn't what I want since, I end up with a separate png for every line drawn. This is a snippet of what is in my on_touch_up function. Executing this produces no error.

if self.collide_point(touch.x,touch.y):
if touch.ud:

x= touch.ud['line'].points

self.export_to_png() # ---> no error

Reply all
Reply to author
Forward
0 new messages