Merge pull request #303 from MikeTheWatchGuy/Dev-latest
Fixed compatibility problems in graph drawing functions
This commit is contained in:
commit
6f6903b94d
|
@ -1265,28 +1265,28 @@ class Graph(Element):
|
|||
return new_x, new_y
|
||||
|
||||
def DrawLine(self, point_from, point_to, color='black', width=1):
|
||||
converted_point_from = self._convert_xy_to_canvas_xy(*point_from)
|
||||
converted_point_to = self._convert_xy_to_canvas_xy(*point_to)
|
||||
converted_point_from = self._convert_xy_to_canvas_xy(point_from[0], point_from[1])
|
||||
converted_point_to = self._convert_xy_to_canvas_xy(point_to[0], point_to[1])
|
||||
return self._TKCanvas2.create_line(converted_point_from, converted_point_to, width=width, fill=color)
|
||||
|
||||
def DrawPoint(self, point, size=2, color='black'):
|
||||
converted_point = self._convert_xy_to_canvas_xy(*point)
|
||||
converted_point = self._convert_xy_to_canvas_xy(point[0], point[1])
|
||||
return self._TKCanvas2.create_oval(converted_point[0]-size, converted_point[1]-size, converted_point[0]+size, converted_point[1]+size, fill=color, outline=color )
|
||||
|
||||
def DrawCircle(self, center_location, radius, fill_color=None, line_color='black'):
|
||||
converted_point = self._convert_xy_to_canvas_xy(*center_location)
|
||||
converted_point = self._convert_xy_to_canvas_xy(center_location[0], center_location[1])
|
||||
return self._TKCanvas2.create_oval(converted_point[0]-radius, converted_point[1]-radius, converted_point[0]+radius, converted_point[1]+radius, fill=fill_color, outline=line_color)
|
||||
|
||||
def DrawOval(self, top_left, bottom_right, fill_color=None, line_color=None):
|
||||
converted_top_left = self._convert_xy_to_canvas_xy(*top_left)
|
||||
converted_bottom_right = self._convert_xy_to_canvas_xy(*bottom_right)
|
||||
return self._TKCanvas2.create_oval(*converted_top_left, *converted_bottom_right, fill=fill_color, outline=line_color)
|
||||
converted_top_left = self._convert_xy_to_canvas_xy(top_left[0], top_left[1])
|
||||
converted_bottom_right = self._convert_xy_to_canvas_xy(bottom_right[0],bottom_right[1])
|
||||
return self._TKCanvas2.create_oval(converted_top_left[0], converted_top_left[1], converted_bottom_right[0], converted_bottom_right[1], fill=fill_color, outline=line_color)
|
||||
|
||||
|
||||
def DrawRectangle(self, top_left, bottom_right, fill_color=None, line_color=None):
|
||||
converted_top_left = self._convert_xy_to_canvas_xy(*top_left)
|
||||
converted_bottom_right = self._convert_xy_to_canvas_xy(*bottom_right)
|
||||
return self._TKCanvas2.create_rectangle(*converted_top_left, *converted_bottom_right, fill=fill_color, outline=line_color)
|
||||
converted_top_left = self._convert_xy_to_canvas_xy(top_left[0], top_left[1] )
|
||||
converted_bottom_right = self._convert_xy_to_canvas_xy(bottom_right[0], bottom_right[1])
|
||||
return self._TKCanvas2.create_rectangle(converted_top_left[0], converted_top_left[1], converted_bottom_right[0], converted_bottom_right[1], fill=fill_color, outline=line_color)
|
||||
|
||||
def Erase(self):
|
||||
self._TKCanvas2.delete('all')
|
||||
|
@ -1298,13 +1298,13 @@ class Graph(Element):
|
|||
zero_converted = self._convert_xy_to_canvas_xy(0,0)
|
||||
shift_converted = self._convert_xy_to_canvas_xy(x_direction, y_direction)
|
||||
shift_amount = (shift_converted[0]-zero_converted[0], shift_converted[1]-zero_converted[1])
|
||||
self._TKCanvas2.move('all', *shift_amount)
|
||||
self._TKCanvas2.move('all', shift_amount[0], shift_amount[1])
|
||||
|
||||
def MoveFigure(self, figure, x_direction, y_direction):
|
||||
zero_converted = self._convert_xy_to_canvas_xy(0,0)
|
||||
shift_converted = self._convert_xy_to_canvas_xy(x_direction, y_direction)
|
||||
shift_amount = (shift_converted[0]-zero_converted[0], shift_converted[1]-zero_converted[1])
|
||||
self._TKCanvas2.move(figure, *shift_amount)
|
||||
self._TKCanvas2.move(figure, shift_amount[0], shift_amount[1])
|
||||
|
||||
@property
|
||||
def TKCanvas(self):
|
||||
|
|
Loading…
Reference in New Issue