Page 1 of 1

Direction needed: simple graphics code

Posted: Mon Nov 09, 2015 2:31 am
by jdrexmo
Sorry if cross-posting is a faux pas here, but I need help with this as soon as possible and I thought maybe I asked in the wrong forum the first time.

I have a Raspberry Pi 2 with a no-touch HDMI backpack. I want to program some fairly simple graphics based on SPI input values. I have found sample code in Python for reading my analog values via MCP3008 and SPI. I'm trying to draw some bell curves on a graph according to those analog values (two values determine coordinates of a point, third value determines width of the curve beneath that point) in more or less real time (I'll be polling the MCP3008 inputs, but would like to instantly redraw when changes are detected). I do not need, or want, a GUI.

Can anyone give me a little direction how to code some basic drawing? In a way that can work with those analog input values?

Re: Direction needed: simple graphics code

Posted: Mon Nov 09, 2015 7:44 am
by ghans
I think the fixation on "needing no GUI" is a bit misguided. Nothing stops you from configuring X to start a single app in fullscreen mode.

That said , have a look into Matplotlib and Numpy.

ghans

Re: Direction needed: simple graphics code

Posted: Tue Nov 10, 2015 3:09 pm
by -rst-
Or even gnuplot (gnuplot-x) ...one hacky way to to avoid 'GUI' (X Window system/desktop) could be to output your data to a file (or pipe), use gnuplot to render an image file and use fbi to display the image - depending on refresh rate requirements obviously...

Such a pity that (apparently) no-one has made anything like this in Python: http://mindchunk.blogspot.no/2012/09/op ... ry-pi.html

Maybe pygame modified to work with framebuffer: https://learn.adafruit.com/pi-video-out ... ramebuffer