Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I have to draw an isosceles triangle using point and line class in python with t

ID: 663875 • Letter: I

Question

I have to draw an isosceles triangle using point and line class in python with the configuration (100,30) (50,100) (150,100)

Here's what I wrote:

from graphics import*

def main():
    win = GraphWin("Triangle",300,300)
  
    start1 = Point(50,100)
    finish1 = Point(150,100)
    line1 = Line(start1,finish1)
    line1.draw(win)

    start2 = Point(100,30)
    finish2 = Point(150,100)
    line2 = Line(start2,finish2)
    line2.draw(win)

    start3 = Point(100,30)
    finish3 = Point(50,100)
    line3 = Line(start3,finish3)
    liine3.draw(win)
    win.getMouse() #Pause to view result
    win.close()    #Close window when done
  
main()


But I cannot get a full triangle to form,only two sides and the screen only briefly flashes the 2 sides and then disappears. What am I doing wrong? I have to submit this tonight before 11:59 p.m.

Explanation / Answer

from graphics import *

def main():
win = GraphWin("My Window", 200, 200)
win.setBackground('white')
start = Point(50, 100)
finish = Point(100, 30)
l = Line(start, finish)
l.draw(win)
start = Point(100, 30)
finish = Point(150, 100)
l = Line(start, finish)
l.draw(win)
start = Point(150, 100)
finish = Point(50, 100)
l = Line(start, finish)
l.draw(win)

win.getMouse()
win.close()

main()