My teacher is teaching us how to draw pictures using Tkinter on Python, but I still need help. I'm new to digital technology, and I'm trying to draw a cone with a scoop of ice-cream. How do I draw a slanted line and circle on Tkinter using this format (example):
ice-creamTk=drawing.create_line(100,105,200,105,400,105,500,105,700,105,width=4)
The numbers I put in are just examples, I don't actually know what I'm doing.
CodePudding user response:
To create the shape of an ice-cream cone you need two lines and an arc.
Assuming you have a root
and a canvas
defined you can use the following code to make two lines in the shape of an upside-down cone:
canvas.create_line(150,200,75,100, fill="brown",width=2)
canvas.create_line(150,200,225,100, fill="brown",width=2)
And to create the arc at the top:
canvas.create_arc(75,175, 225,25, start=0, extent=180, fill="yellow",width=0)
The above code will give you the following result: