0

How to draw in the console?

I searched about it on the Internet, but did not understand anything. Perhaps you can explain to me how to output shapes to the console and how to animate them, how to center them, and the like. But first me. More asego is interested in just outputting figures to the console. How to do it?

3rd Feb 2023, 7:55 AM
CODER
CODER - avatar
4 Answers
+ 6
Do you mean the pattern challenges? Basically, you just print out characters so that they form a figure like a star or a crown. Have a look at the user submissions for inspiration. Some users created animations with svg or css on sololearn Python playground, for instance, however this does not work on every regular console.
3rd Feb 2023, 8:23 AM
Lisa
Lisa - avatar
+ 2
First off, I'd like to clarify that sololearn output isn't from a true console. A graphics renderer can be implemented in a true console for languages like c++ but because python uses interpreter, I've managed to find a workaround sometimes ago. Also you can find the basic syntax for drawing in Minho 🇰🇷 java's implementation You will basically be working with "ctypes" module of python so you can create pointers and do some pixel manipulation for drawing sprites etc. Then the animation part is a constant "while true" loop, where you'll be clearing the console and redrawing each pixels at maybe 60fps in addition, this process is hard and if you are not good at optimization, performance of your renderer will suffer cos, writing to the console is generally a slow operation. also you will need to know more about the operating system you're working with https://code.sololearn.com/coCNnke3Ny2h/?ref=app
3rd Feb 2023, 8:50 AM
Mirielle
Mirielle - avatar
0
A console only allows for static output. For animations you need create a graphical window, usually with some canvas to draw upon.
3rd Feb 2023, 8:10 AM
Lisa
Lisa - avatar
0
I'm not talking about canvas, but drawing using characters that we output to the console. I have seen animations done using new frame output. But I'm more interested in at least the usual output of the figure to the console
3rd Feb 2023, 8:18 AM
CODER
CODER - avatar