0% found this document useful (0 votes)
2 views1 page

Draw Equilateral Triangle with Python

Uploaded by

dom hez
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

Draw Equilateral Triangle with Python

Uploaded by

dom hez
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Python code triangle

import tkinter

import [Link]

class equilateral_triangles:

def __init__(self):

self.main_window = [Link]()

[Link] = [Link](self.main_window,width=400,height=400)

[Link].create_line(300,300,100,300,100,300,200,127,300,300)

[Link]()

[Link]()

_triangle = equilateral_triangles()

Common questions

Powered by AI

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()' .

You might also like