Skip to content Skip to sidebar Skip to footer

How To Draw A Right Angle Triangle Using Tkinter?

I'm trying to draw a right angle triangle with tkinter. I can't figure out how to do it, I can do a rectangle and then another one but I cant get the second rectangle to be a trian

Solution 1:

You can use polygon-function to draw a triangle. Just specify a list of corner-points of your triangle as argument.

points = [x1,y1, x2,y2, x3,y3]
can.create_polygon(points, fill='white')

Check out the tkinter-documentation for more info.


Solution 2:

You should use create_polygon() to draw triangle:

shape2={'bounds': [20, 50, 80, 35, 80, 50], 'kind': 'tri', 'fill': True}
can.create_polygon(list(shape2.values())[0],fill='white',outline='white')

Post a Comment for "How To Draw A Right Angle Triangle Using Tkinter?"