How to draw a right angle triangle using tkinter?

后端 未结 2 1366
情书的邮戳
情书的邮戳 2021-01-28 18:22

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

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-28 19:09

    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.

提交回复
热议问题