Python Forum

Full Version: Plotting pixels
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
The last time I did any programming was over 25 years ago using Quickbasic 4.5. Does anyone remember that? Rolleyes I messed about with graphics just for fun.

Having time on my hands in lockdown, I decided to have another foray into programming, so starting afresh with Python, but have spent most of today trying unsuccessfully to plot pixels on the screen.
I'm using Visual Studio Code as my editor, and have used pip to install various modules like Matplotlib, Numpy, Pyxel, PIL, Pylab etc. but just cannot seem to get on the right track.

I have managed to follow some code from the internet that has enabled me to draw simple graphs into an array and then save to an image file and bring up the image, but that is not the way I want to do it. I simply need to see pixels building up on screen in real time according to the various mathematical/fractal/chaotic formula I want to play with. The formulae I'm talking about run in a loop or nested loops through thousands of iterations and at various instances if certain conditions are met, points will be plotted on screen individually. Images aren't produced instantly and can sometimes take minutes or longer to run plotting pixel by pixel.

In the old days, for a very simple program, I didn't need modules, I'd just set up the screen size I wanted, do the math, get the coordinates and plot pixels using something like "pset(x,y),color" in just a couple of dozen lines of code.

Can someone please show me some code, a simple framework, within which I can run the loops and plot the pixels individually to get me started, before I give up and admit defeat.

Thanks for reading.