Draw Equilateral Triangle with Python
Draw Equilateral Triangle with Python
The 'equilateral_triangles' class uses the tkinter module to create a window and canvas for drawing. Within its '__init__' method, it initializes a tkinter window (main_window) and a canvas (with dimensions 400x400). It then calls 'create_line' on the canvas to draw the sides of an equilateral triangle by specifying the coordinates of its vertices (300,300; 100,300; 200,127). After creating the triangle, it packs the canvas into the main window and initiates the tkinter main event loop with 'tkinter.mainloop()' .