3 ms·
How do you draw a line on the screen in Python? Here's BASIC. I'm not saying this is good. But it is easy. SCREEN 13 LINE (X1, Y1) - (X2, Y2), COLOUR
by DanBC 6y ago
How do you draw a line on the screen in Python? Here's BASIC. I'm not saying this is good. But it is easy.
SCREEN 13
LINE (X1, Y1) - (X2, Y2), COLOUR
- dragonwriter 6y ago> How do you draw a line on the screen in Python? Using only stdlib: import turtle turtle.penup() turtle.pencolor(colour) turtle.setpos(x1,y1) turtle.pendown() turtle.goto(x2,y2)
- ksaj 6y agoI am guessing that is straight-up LOGO on Python.
- dragonwriter 6y agoNot exactly, but the turtle library was inspired by Logo, and designed to enable fairly direct translation of Logo code.
- publicola1990 6y agoIt is turtle library inspired by Logo alright, but important thing is that it was available from very early versions of python onwards, and by default available when python is installed.
- ksaj 6y agoI didn't realize the lib was in there by default. It is instantly recognizable as Logo, although the syntax is clearly python. This video from Mathologer about solving polynomial equations might be just as easy to implement in Python with that library as it would be under NetLogo (a more multi-dimensional science-oriented implementation of Logo), which certainly justifies having a turtle library to begin with: https://www.youtube.com/watch?v=IUC-8P0zXe8 https://www.youtube.com/watch?v=IUC-8P0zXe8 I'd hate to program that under BASIC.
- amelius 6y agoI tried it and it works. But that drawing window seems almost broken. It doesn't repaint properly when I resize it, and closing it seems impossible.
- indymike 6y agoThis is where a lot of modern languages are hard for kids. You have to find a library to do things you want to do.