Merge pull request #1416 from PySimpleGUI/Dev-latest
Fix from user musteresel - uses dictionary to save images in so no mo…
This commit is contained in:
commit
2284be6ee2
|
@ -2032,7 +2032,7 @@ class Graph(Element):
|
||||||
self.DragSubmits = drag_submits
|
self.DragSubmits = drag_submits
|
||||||
self.ClickPosition = (None, None)
|
self.ClickPosition = (None, None)
|
||||||
self.MouseButtonDown = False
|
self.MouseButtonDown = False
|
||||||
self.Images = []
|
self.Images = {}
|
||||||
self.RightClickMenu = right_click_menu
|
self.RightClickMenu = right_click_menu
|
||||||
|
|
||||||
super().__init__(ELEM_TYPE_GRAPH, background_color=background_color, size=canvas_size, pad=pad, key=key,
|
super().__init__(ELEM_TYPE_GRAPH, background_color=background_color, size=canvas_size, pad=pad, key=key,
|
||||||
|
@ -2190,6 +2190,7 @@ class Graph(Element):
|
||||||
self.Images.append(image)
|
self.Images.append(image)
|
||||||
try: # in case closed with X
|
try: # in case closed with X
|
||||||
id = self._TKCanvas2.create_image(converted_point, image=image, anchor=tk.NW)
|
id = self._TKCanvas2.create_image(converted_point, image=image, anchor=tk.NW)
|
||||||
|
self.Images[id] = image
|
||||||
except:
|
except:
|
||||||
id = None
|
id = None
|
||||||
return id
|
return id
|
||||||
|
@ -2201,6 +2202,7 @@ class Graph(Element):
|
||||||
print('*** WARNING - The Graph element has not been finalized and cannot be drawn upon ***')
|
print('*** WARNING - The Graph element has not been finalized and cannot be drawn upon ***')
|
||||||
print('Call Window.Finalize() prior to this operation')
|
print('Call Window.Finalize() prior to this operation')
|
||||||
return None
|
return None
|
||||||
|
self.Images = {}
|
||||||
try: # in case window was closed with X
|
try: # in case window was closed with X
|
||||||
self._TKCanvas2.delete('all')
|
self._TKCanvas2.delete('all')
|
||||||
except:
|
except:
|
||||||
|
@ -2209,6 +2211,7 @@ class Graph(Element):
|
||||||
|
|
||||||
def DeleteFigure(self, id):
|
def DeleteFigure(self, id):
|
||||||
try:
|
try:
|
||||||
|
del self.Images[id]
|
||||||
self._TKCanvas2.delete(id)
|
self._TKCanvas2.delete(id)
|
||||||
except:
|
except:
|
||||||
print('DeleteFigure - bad ID {}'.format(id))
|
print('DeleteFigure - bad ID {}'.format(id))
|
||||||
|
|
Loading…
Reference in New Issue