Hello,
 
I tried to generate a image stream with matplotlib and return in into html. 
Something like http://www.web2pyslices.com/slice/show/1357/matplotlib-howto
It works perfectly.
 
In comparison to this, I want generate several image's streams in one 
function, and then get it out.
The idea behind this is that I have similar calculation for some images and 
I want it run only once time.
 
The code should be:
 
def plot1(type=s):
     xxxxxx
     xxxxxx
     return stream.getvalue()
##-------------------------------------------------------------------
##-------------------------------------------------------------------
def stream_plot():
     res1 = plot1(type1)
     res2=   plot1(type2)
     return res1, res2
##-------------------------------------------------------------------
##-------------------------------------------------------------------
def controllerfunc():
     test1,test2 = stream_plot() 
     return dict(bc=IMG(_src=test1), bc1=IMG(_src=test2))
 
In the last function, bc and bc1 will be directly showed in the view like 
{{=bc}},  {{=bc1}}
 
 
But I have a problem. Instead of image in view , I see something like 
"�PNG%1A���IHDR��%05�%03%7C%08%06��������%04sBIT%08%08%08%08%7C%08d����pHYs��%0Fa��%0Fa%"..
 

 
What is wrong with this code ?
 
Thank you for your advise!

 

 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to