DRAW with python turtle!
I managed to program a basic drawing app using only the python turtle module! It was pretty fun to code. I attached some drawings I made ^-^
EDIT: WOW I'M IN THE NEWSLETTER!? I'm honoured! (https://replit-newsletter-16--timmy-i-chen.repl.co/?ref=newsletter)
I'm working on a couple games, so watch out! (Although they probably won't be done soon, because it's GCSE year, ugh...)
This code was pretty cool. I would like to understand how you did your code. I am pretty recent into coding with Java
@AnkurAhir Thank you! I am self-taught and used a website called Codecademy to learn Python. I then read through the Python Turtle documentation for some interesting functions (the screen.onkey ones let you use keys!) and implemented them into my code. So yeah. Highly recommend Codecademy.
t = turtle.Turtle()
y = turtle.Turtle()
tsize = 10
screen = turtle.Screen()
tcolour = (0,0,0)
colour = input("Input colour string (DON'T TYPE IT HERE!) \n")
tcolour = (int(colour[0:3]), int(colour[3:6]), int(colour[6:9]))
tsize = t.pensize() + 2
tsize = t.pensize() - 2
tcolour = (0,0,0)
tcolour = (0,255,200)
tcolour = (255,255,255)
print("""Hey you! You're obviously really bored, since you're running my slightly trashy, slightly unfinished drawing program. (It's probably a rival to MS Paint though.)
Here are the controls:
Click to move the pen, click and drag to draw. Yes, click twice. Deal with it.
The left and right arrows decrease and increase pen size, respectively.
Space clears the canvas.
Pressing X lets you change the pen colour by inputting a colour string.
Quick colour shortcuts: 1-Black, 2-Jade, 3-White (eraser).
I have no idea how to program a 'save' so just screenshot the result.
A NOTE ON COLOUR STRINGS:
First, input them CORRECTLY. RRRGGGBBB, no spaces, no letters, no values over 255. I didn't bother babyproofing this, as common sense exists.
Second, DON'T TYPE THEM IN HERE. The enter key causes the program to refresh, clearing the input in the process. See that little arrow/box icon in the corner? Click it and type the colour string there instead, then hit the enter button. (Ignore the error message, the color would have changed on the 'result'.) I don't know why, but it works.""")
Please let me know if you catch any bugs! I know you almost always have to click the pen twice to draw, this was inevitable since otherwise the pen won't move from place to place :O