Error:
Python 3.8.2 (default, Apr 27 2020, 15:53:34)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from gasp import *
>>> begin_graphics()
>>> Line((200,200),(150,350))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/mdnabiltech/Projects/GASP/GASP_Tkinter/gasp/gasp.py", line 162, in __repr__
f"<Line object from ({self.pos[0]}, {self.pos[1]})>"
NameError: name 'rise' is not defined
Gasp.py File:
class Line:
"""Draw a line segment between p1 and p2."""
def __init__(self, p1, p2, color=color.BLACK, thickness=1):
self.pos = p1
self.rise = p2[0] - p1[0]
self.run = p2[1] - p1[1]
self.coord_list = [
p1[0],
_canvas_ys - p1[1],
p2[0],
_canvas_ys - p2[1]
]
self.id = _canvas.create_line(*self.coord_list, fill=color, width=thickness)
_canvas.update()
def __repr__(self):
return (
f"<Line object from ({self.pos[0]}, {self.pos[1]})>"
f" to ({self.pos[0] + rise}, {self.pos[1] - run})>"
)