Okay, so if you have the image data available in the Python environment in 
the extension, then you can get it back to the NetLogo side by converting 
it to a base64 string, then using the ImportA Extension 
<https://github.com/NetLogo/ImportA-Extension> to put that data where you 
need it.  The process for encoding it in base64 will vary depending on the 
format, but it should be an option as it's a common operation.

I hope that helps, let me know if you need more details.

-Jeremy

On Monday, May 6, 2024 at 12:13:18 PM UTC-5 Brady, Corey wrote:

> Hi Jeremy – 
>
>  
>
> Thanks for your note!  Clarification below…
>
>
> In the py extension, there is only the py:runresult  primitive for getting 
> information back from python processes.
>
>  
>
> In the scenario I’m working with, I have created an image (actually, it’ll 
> be many frames)..  that I want to bring into netlogo via import-drawing 
> and/or import-pcolors.
>
>  
>
> If I use py:runresult, I get an error that the image is not JSON 
> serializable. 
>
>
> Have others run into this or similar problem & solved it?
>
>  
>
> Thanks!
> -Corey 
>
>  
>
>  
>
> *Corey Brady*
>
> *Associate Professor, Mathematics Education and the Learning Sciences*
>
> *corey...@smu.edu*
>
> Department of Teaching and Learning
>
> Simmons School of Education and Human Development
>
> [image: A blue and red logo Description automatically generated]
>
>  
>
> *From: *<netlog...@googlegroups.com> on behalf of "
> jeremy...@northwestern.edu" <jeremy...@northwestern.edu>
> *Date: *Monday, May 6, 2024 at 11:00 AM
> *To: *netlogo-devel <netlog...@googlegroups.com>
> *Subject: *[netlogo-devel] Re: Python returning image to NetLogo for 
> "import-drawing" or "import-pcolors"
>
>  
>
> You don't often get email from jeremy...@northwestern.edu. Learn why this 
> is important <https://aka.ms/LearnAboutSenderIdentification>
>
> Hey Corey, 
>
>  
>
> Do you have more details on what the problem you're having is?  What isn't 
> working about just using the import primitives as-is?  Do you mean 
> importing image data that's generated in the Python extension in a NetLogo 
> model, or just generally from Python?  
>
>  
>
> Thanks.
>
>  
>
> -Jeremy
>
> On Sunday, May 5, 2024 at 3:19:01 PM UTC-5 Brady, Corey wrote:
>
> Hello !
>
> I was wondering if anyone has solved the problem of getting an image 
> created in python to NetLogo’s import-xx primitives.
>
> I imagine there are several possible approaches, but it seems like a 
> common enough need that someone might have solved the problem already.
>
> Any word of solutions?
>
> Thanks!
> -Corey
>
>  
>
> *Corey Brady*
>
> *Associate Professor, Mathematics Education and the Learning Sciences*
>
> *corey...@smu.edu*
>
> Department of Teaching and Learning
>
> Simmons School of Education and Human Development
>
> [image: Image removed by sender. A blue and red logo Description 
> automatically generated]
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "netlogo-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to netlogo-deve...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/netlogo-devel/573498f5-65f4-4312-81f8-41013412f1dbn%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/netlogo-devel/573498f5-65f4-4312-81f8-41013412f1dbn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"netlogo-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to netlogo-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/netlogo-devel/f99c09fe-c402-4900-8400-14bbf46a950bn%40googlegroups.com.

Reply via email to