How to draw a right angle triangle using tkinter?

后端 未结 2 1362
情书的邮戳
情书的邮戳 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条回答
  • 2021-01-28 18:52

    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')
    
    0 讨论(0)
  • 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.

    0 讨论(0)
提交回复
热议问题