Merge pull request #874 from MikeTheWatchGuy/Dev-latest

Dev latest
This commit is contained in:
MikeTheWatchGuy 2018-12-07 20:26:09 -05:00 committed by GitHub
commit 9c3f9d4688
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 10 deletions

BIN
ButtonGraphics/Play.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

View File

@ -1668,8 +1668,6 @@ class Image(Element):
image = tk.PhotoImage(data=data)
except:
return # an error likely means the window has closed so exit
# else:
# image = data
else:
return
width, height = size[0] or image.width(), size[1] or image.height()
@ -1741,6 +1739,7 @@ class Graph(Element):
self.DragSubmits = drag_submits
self.ClickPosition = (None, None)
self.MouseButtonDown = False
self.Images = []
super().__init__(ELEM_TYPE_GRAPH, background_color=background_color, size=canvas_size, pad=pad, key=key,
tooltip=tooltip, visible=visible)
return
@ -1845,6 +1844,30 @@ class Graph(Element):
angle=angle)
return text_id
def DrawImage(self, filename=None, data=None, location=(None, None), color='black', font=None, angle=0):
if location == (None, None):
return
if filename is not None:
image = tk.PhotoImage(file=filename)
elif data is not None:
# if type(data) is bytes:
try:
image = tk.PhotoImage(data=data)
except:
return None # an error likely means the window has closed so exit
converted_point = self._convert_xy_to_canvas_xy(location[0], location[1])
if self._TKCanvas2 is None:
print('*** WARNING - The Graph element has not been finalized and cannot be drawn upon ***')
print('Call Window.Finalize() prior to this operation')
return None
self.Images.append(image)
print(image, converted_point)
text_id = self._TKCanvas2.create_image(converted_point, image=image, anchor=tk.NW)
return text_id
def Erase(self):
if self._TKCanvas2 is None:
print('*** WARNING - The Graph element has not been finalized and cannot be drawn upon ***')
@ -5637,6 +5660,8 @@ class DebugWin():
self.Close()
def Close(self):
if self.window is None:
return
self.window.Close()
self.window.__del__()
self.window = None

View File

@ -2647,17 +2647,11 @@ class Table(Element):
:param max_col_width:
:param select_mode:
:param display_row_numbers:
:param num_rows:
:param row_height:
:param font:
:param justification:
:param text_color:
:param background_color:
:param alternating_row_color:
:param size:
:param change_submits:
:param enable_events:
:param bind_return_key:
:param pad:
:param key:
:param tooltip:
@ -3013,7 +3007,7 @@ class Window(object):
return self
def LayoutAndRead(self, rows, non_blocking=False):
raise DeprecationWarning('LayoutAndRead is no longer supported... change your call window.Layout(layout).Read()')
raise DeprecationWarning('LayoutAndReaLayoutAndRead is no longer supported... change your call window.Layout(layout).Read()')
# self.AddRows(rows)
# self.Show(non_blocking=non_blocking)
# return self.ReturnValues
@ -5531,6 +5525,8 @@ class DebugWin(object):
self.Close()
def Close(self):
if self.window is None:
return
self.window.Close()
self.window.__del__()
self.window = None
@ -6953,7 +6949,7 @@ def PopupGetFolder(message, title=None, default_path='', no_window=False, size=(
font=font, no_titlebar=no_titlebar, grab_anywhere=grab_anywhere, keep_on_top=keep_on_top,
location=location)
(button, input_values) = window.LayoutAndRead(layout)
(button, input_values) = window.Layout(layout).Read()
if button != 'Ok':
return None