Merge pull request #1333 from PySimpleGUI/Dev-latest

Dev latest
This commit is contained in:
MikeTheWatchGuy 2019-04-22 18:47:52 -04:00 committed by GitHub
commit e5305422ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 156 additions and 63 deletions

View File

@ -1478,7 +1478,7 @@ class Button(Element):
self.AutoSizeButton = auto_size_button self.AutoSizeButton = auto_size_button
self.BType = button_type self.BType = button_type
self.FileTypes = file_types self.FileTypes = file_types
self.TKButton = None self.TKButton = None # type: tk.Button
self.Target = target self.Target = target
self.ButtonText = str(button_text) self.ButtonText = str(button_text)
if sys.platform == 'darwin' and button_color is not None: if sys.platform == 'darwin' and button_color is not None:
@ -2013,7 +2013,7 @@ class Graph(Element):
self.BottomLeft = graph_bottom_left self.BottomLeft = graph_bottom_left
self.TopRight = graph_top_right self.TopRight = graph_top_right
self._TKCanvas = None self._TKCanvas = None
self._TKCanvas2 = None self._TKCanvas2 = None # Type: tk.Canvas
self.ChangeSubmits = change_submits or enable_events self.ChangeSubmits = change_submits or enable_events
self.DragSubmits = drag_submits self.DragSubmits = drag_submits
self.ClickPosition = (None, None) self.ClickPosition = (None, None)
@ -2230,6 +2230,19 @@ class Graph(Element):
return None return None
self._TKCanvas2.move(figure, shift_amount[0], shift_amount[1]) self._TKCanvas2.move(figure, shift_amount[0], shift_amount[1])
def RelocateFigure(self, figure, x, y):
zero_converted = self._convert_xy_to_canvas_xy(0, 0)
shift_converted = self._convert_xy_to_canvas_xy(x, y)
shift_amount = (shift_converted[0] - zero_converted[0], shift_converted[1] - zero_converted[1])
if figure is None:
print('*** WARNING - Your figure is None. It most likely means your did not Finalize your Window ***')
print('Call Window.Finalize() prior to all graph operations')
return None
xy = self._TKCanvas2.coords(figure)
self._TKCanvas2.move(figure, shift_converted[0]-xy[0], shift_converted[1]-xy[1])
@property @property
def TKCanvas(self): def TKCanvas(self):
if self._TKCanvas2 is None: if self._TKCanvas2 is None:
@ -4994,6 +5007,7 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form):
tktext_label.bind('<Button-3>', element.RightClickMenuCallback) tktext_label.bind('<Button-3>', element.RightClickMenuCallback)
# ------------------------- BUTTON element ------------------------- # # ------------------------- BUTTON element ------------------------- #
elif element_type == ELEM_TYPE_BUTTON: elif element_type == ELEM_TYPE_BUTTON:
element = element # type: Button
stringvar = tk.StringVar() stringvar = tk.StringVar()
element.TKStringVar = stringvar element.TKStringVar = stringvar
element.Location = (row_num, col_num) element.Location = (row_num, col_num)

View File

@ -16,7 +16,7 @@
![Python Version](https://img.shields.io/badge/Python-3.x-yellow.svg) ![Python Version](https://img.shields.io/badge/Python-3.x-yellow.svg)
![Python Version](https://img.shields.io/badge/PySimpleGUIQt_For_Python_3.x_Version-00.26.0-orange.svg?longCache=true&style=for-the-badge) ![Python Version](https://img.shields.io/badge/PySimpleGUIQt_For_Python_3.x_Version-00.26431.0-orange.svg?longCache=true&style=for-the-badge)
@ -26,7 +26,7 @@
"Qt without the ugly" "Qt without the ugly"
## The Alpha Release ## The Alpha Release Version 0.231.0
[Announcements of Latest Developments](https://github.com/MikeTheWatchGuy/PySimpleGUI/issues/142) [Announcements of Latest Developments](https://github.com/MikeTheWatchGuy/PySimpleGUI/issues/142)
@ -682,4 +682,7 @@ Dial - disable
# License # License
GNU Lesser General Public License (LGPL 3) + GNU Lesser General Public License (LGPL 3) +
# Acknowledgments # Acknowledgments
<!--stackedit_data:
eyJoaXN0b3J5IjpbLTQwNDYzOTE3Nl19
-->

View File

@ -70,7 +70,7 @@ def TimerStop():
""" """
# Because looks matter... # Because looks matter...
DEFAULT_BASE64_ICON = b'iVBORw0KGgoAAAANSUhEUgAAACEAAAAgCAMAAACrZuH4AAAABGdBTUEAALGPC/xhBQAAAwBQTFRFAAAAMGmYMGqZMWqaMmubMmycM22dNGuZNm2bNm6bNG2dN26cNG6dNG6eNW+fN3CfOHCeOXGfNXCgNnGhN3KiOHOjOXSjOHSkOnWmOnamOnanPHSiPXakPnalO3eoPnimO3ioPHioPHmpPHmqPXqqPnurPnusPnytP3yuQHimQnurQn2sQH2uQX6uQH6vR32qRn+sSXujSHynTH2mTn+nSX6pQH6wTIGsTYKuTYSvQoCxQoCyRIK0R4S1RYS2Roa4SIe4SIe6SIi7Soq7SYm8SYq8Sou+TY2/UYStUYWvVIWtUYeyVoewUIi0VIizUI6+Vo+8WImxXJG5YI2xZI+xZ5CzZJC0ZpG1b5a3apW4aZm/cZi4dJ2/eJ69fJ+9XZfEZZnCZJzHaZ/Jdp/AeKTI/tM8/9Q7/9Q8/9Q9/9Q+/tQ//9VA/9ZA/9ZB/9ZC/9dD/9ZE/tdJ/9dK/9hF/9hG/9hH/9hI/9hJ/9hK/9lL/9pK/9pL/thO/9pM/9pN/9tO/9tP/9xP/tpR/9xQ/9xR/9xS/9xT/91U/91V/t1W/95W/95X/95Y/95Z/99a/99b/txf/txh/txk/t5l/t1q/t5v/+Bb/+Bc/+Bd/+Be/+Bf/+Bg/+Fh/+Fi/+Jh/+Ji/uJk/uJl/+Jm/+Rm/uJo/+Ro/+Rr/+Zr/+Vs/+Vu/+Zs/+Zu/uF0/uVw/+dw/+dz/+d2/uB5/uB6/uJ9/uR7/uR+/uV//+hx/+hy/+h0/+h2/+l4/+l7/+h8gKXDg6vLgazOhKzMiqrEj6/KhK/Qka/Hk7HJlLHJlLPMmLTLmbbOkLXSmLvXn77XoLrPpr/Tn8DaocLdpcHYrcjdssfZus/g/uOC/uOH/uaB/uWE/uaF/uWK/+qA/uqH/uqI/uuN/uyM/ueS/ueW/ueY/umQ/uqQ/uuS/uuW/uyU/uyX/uqa/uue/uye/uyf/u6f/uyq/u+r/u+t/vCm/vCp/vCu/vCy/vC2/vK2/vO8/vO/wtTjwtXlzdrl/vTA/vPQAAAAiNpY5gAAAQB0Uk5T////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////AFP3ByUAAAAJcEhZcwAAFw8A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////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////AFP3ByUAAAAJcEhZcwAAFw8AABcPASe7rwsAAAAYdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjEuMWMqnEsAAAKUSURBVDhPhdB3WE1xHMdxt5JV0dANoUiyd8kqkey996xclUuTlEKidO3qVnTbhIyMW/bee5NskjJLmR/f3++cK/94vP76Ps/n/Zx7z6mE/6koJowcK154vvHOL/GsKCZXkUgkWlf4vWGWq5tsDz+JWIzSokAiqXGe7nWu3HxhEYof7fhOqp1GtptQuMruVhQdxZ05U5G47tYUHbQ4oah6Fg9Z4ubm7i57JhQjdHS0RSzUPoG17u6zZTKZh8c8XlytqW9YWUOH1LqFOZ6enl5ec+XybFb0rweM1tPTM6yuq6vLs0lYJJfLvb19fHwDWGF0jh5lYNAe4/QFemOwxtfXz8/fPyBgwVMqzAcCF4ybAZ2MRCexJGBhYGBQUHDw4u1UHDG1G2ZqB/Q1MTHmzAE+kpCwL1RghlTaBt/6SaXS2kx9YH1IaOjSZST8vfA9JtoDnSngGgL7wkg4WVkofA9mcF1Sx8zMzBK4v3wFiYiMVLxlEy9u21syFhYNmgN7IyJXEYViNZvEYoCVVWOmUVvgQVSUQqGIjolRFvOAFd8HWVs34VoA+6OjY2JjY5Vxm4BC1UuhGG5jY9OUaQXci1MqlfHx8YmqjyhOViW9ZsUN29akJRmPFwkJCZsTSXIpilJffXiTzorLXYgtcxRJKpUqKTklJQ0oSt9FP/EonxVdNY4jla1kK4q2ZB6mIr+AipvduzFUzMSOtLT09IyMzMxtJKug/F0u/6dTexAWDcXXLGEjapKjfsILOLKEuYiSnTQeYCt3UHhbwEHjGMrETfBJU5zq5dSTcXC8hLJccSWP2cgLXHPu7cQNAcpyxF1dyjehAKb0cSYUAOXCUw6V8OFPgevTXFymC+fPPLU677Nw/1X8A/AbfAKGulaqFlIAAAAASUVORK5CYII='
# ----====----====----==== Constants the user CAN safely change ====----====----====----# # ----====----====----==== Constants the user CAN safely change ====----====----====----#
@ -1663,17 +1663,21 @@ class Image(Element):
class SuperImage(remi.gui.Image): class SuperImage(remi.gui.Image):
def __init__(self, file_path_name=None, **kwargs): def __init__(self, file_path_name=None, **kwargs):
super(SuperImage, self).__init__("/res/logo.png", **kwargs) image = file_path_name
super(SuperImage, self).__init__(image, **kwargs)
self.imagedata = None self.imagedata = None
self.mimetype = None self.mimetype = None
self.encoding = None self.encoding = None
self.load(file_path_name) self.load(image)
def load(self, file_path_name): def load(self, file_path_name):
self.mimetype, self.encoding = mimetypes.guess_type(file_path_name) if type(file_path_name) is bytes or len(file_path_name) > 200:
with open(file_path_name, 'rb') as f: self.imagedata = base64.b64decode(file_path_name)
self.imagedata = f.read() else:
self.mimetype, self.encoding = mimetypes.guess_type(file_path_name)
with open(file_path_name, 'rb') as f:
self.imagedata = f.read()
self.refresh() self.refresh()
def refresh(self): def refresh(self):
@ -1712,6 +1716,7 @@ class Graph(Element):
self.MouseButtonDown = False self.MouseButtonDown = False
self.Disabled = disabled self.Disabled = disabled
self.Widget = None # Type: remi.gui.Svg self.Widget = None # Type: remi.gui.Svg
self.SvgGroup = None # Type: remi.gui.SvgGroup
super().__init__(ELEM_TYPE_GRAPH, size=canvas_size, size_px=size_px, visible=visible, background_color=background_color, pad=pad, tooltip=tooltip, key=key) super().__init__(ELEM_TYPE_GRAPH, size=canvas_size, size_px=size_px, visible=visible, background_color=background_color, pad=pad, tooltip=tooltip, key=key)
return return
@ -1745,7 +1750,7 @@ class Graph(Element):
return None return None
line = remi.gui.SvgLine(converted_point_from[0], converted_point_from[1], converted_point_to[0], converted_point_to[1]) line = remi.gui.SvgLine(converted_point_from[0], converted_point_from[1], converted_point_to[0], converted_point_to[1])
line.set_stroke(width, color) line.set_stroke(width, color)
self.Widget.append([line,]) self.SvgGroup.append([line,])
def DrawPoint(self, point, size=2, color='black'): def DrawPoint(self, point, size=2, color='black'):
if point == (None, None): if point == (None, None):
@ -1755,11 +1760,10 @@ 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
print(f'Draw Point', point, converted_point)
rpoint = remi.gui.SvgCircle(converted_point[0], converted_point[1], size) rpoint = remi.gui.SvgCircle(converted_point[0], converted_point[1], size)
rpoint.set_stroke(size, color) rpoint.set_stroke(size, color)
rpoint.set_fill(color) rpoint.set_fill(color)
self.Widget.append([rpoint,]) self.SvgGroup.append([rpoint,])
return rpoint return rpoint
@ -1771,12 +1775,12 @@ 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
print(f'Draw Circle', center_location, converted_point)
rpoint = remi.gui.SvgCircle(converted_point[0], converted_point[1], radius=radius) rpoint = remi.gui.SvgCircle(converted_point[0], converted_point[1], radius=radius)
rpoint.set_fill(fill_color) rpoint.set_fill(fill_color)
self.Widget.append([rpoint,]) self.SvgGroup.append([rpoint,])
return rpoint return rpoint
def DrawOval(self, top_left, bottom_right, fill_color=None, line_color=None): def DrawOval(self, top_left, bottom_right, fill_color=None, line_color=None):
converted_top_left = self._convert_xy_to_canvas_xy(top_left[0], top_left[1]) 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]) converted_bottom_right = self._convert_xy_to_canvas_xy(bottom_right[0], bottom_right[1])
@ -1808,7 +1812,7 @@ class Graph(Element):
rpoint = remi.gui.SvgRectangle(converted_top_left[0], converted_bottom_right[1], bottom_right[0]-top_left[0], top_left[1]-bottom_right[1]) rpoint = remi.gui.SvgRectangle(converted_top_left[0], converted_bottom_right[1], bottom_right[0]-top_left[0], top_left[1]-bottom_right[1])
rpoint.set_stroke(color=line_color) rpoint.set_stroke(color=line_color)
rpoint.set_fill(fill_color) rpoint.set_fill(fill_color)
self.Widget.append([rpoint,]) self.SvgGroup.append([rpoint,])
return rpoint return rpoint
@ -1823,7 +1827,8 @@ class Graph(Element):
return None return None
rpoint = remi.gui.SvgText(converted_point[0], converted_point[1], text) rpoint = remi.gui.SvgText(converted_point[0], converted_point[1], text)
self.Widget.append([rpoint,]) self.SvgGroup.append([rpoint,])
self.SvgGroup.redraw()
return rpoint return rpoint
@ -1839,11 +1844,19 @@ 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
image_widget = SuperImage(image_source)
image_widget.attributes['x'] = converted_point[0]
image_widget.attributes['y'] = converted_point[1] rpoint = remi.gui.SvgImage(image_source, converted_point[0], converted_point[0], size[0], size[1])
i = int(time.time() * 1e6)
# rpoint.set_image(image_source)
self.SvgGroup.append([rpoint,])
self.SvgGroup.redraw()
# image_widget.attributes['x'] = converted_point[0]
# image_widget.attributes['y'] = converted_point[1]
# image_widget.style['background-repeat'] = 'no-repeat' # image_widget.style['background-repeat'] = 'no-repeat'
self.Widget.append([image_widget,]) # self.Widget.data = shape
# self.Widget.add_child("image", shape)
# self.Widget.append([shape,])
def Erase(self): def Erase(self):
if self.Widget is None: if self.Widget is None:
@ -1851,6 +1864,8 @@ class Graph(Element):
print('Call Window.Finalize() prior to this operation') print('Call Window.Finalize() prior to this operation')
return None return None
self.Widget.empty() self.Widget.empty()
self.SvgGroup = remi.gui.SvgGroup(0,0)
self.Widget.append(self.SvgGroup)
def Update(self, background_color): def Update(self, background_color):
if self.Widget is None: if self.Widget is None:
@ -1864,11 +1879,26 @@ class Graph(Element):
zero_converted = self._convert_xy_to_canvas_xy(0, 0) zero_converted = self._convert_xy_to_canvas_xy(0, 0)
shift_converted = self._convert_xy_to_canvas_xy(x_direction, y_direction) 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]) shift_amount = (shift_converted[0] - zero_converted[0], shift_converted[1] - zero_converted[1])
if self._TKCanvas2 is None: if self.Widget is None:
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
return # TODO cur_x = float(self.SvgGroup.attributes['x'])
cur_y = float(self.SvgGroup.attributes['y'])
self.SvgGroup.set_position(cur_x - x_direction,cur_y - y_direction)
self.SvgGroup.redraw()
def Relocate(self, x, y):
shift_converted = self._convert_xy_to_canvas_xy(x, y)
if self.Widget is None:
print('*** WARNING - Your figure is None. It most likely means your did not Finalize your Window ***')
print('Call Window.Finalize() prior to all graph operations')
return None
# figure.empty()
self.SvgGroup.set_position(shift_converted[0], shift_converted[1])
self.SvgGroup.redraw()
def MoveFigure(self, figure, x_direction, y_direction): def MoveFigure(self, figure, x_direction, y_direction):
figure = figure #type: remi.gui.SvgCircle figure = figure #type: remi.gui.SvgCircle
@ -1879,12 +1909,27 @@ class Graph(Element):
print('*** WARNING - Your figure is None. It most likely means your did not Finalize your Window ***') print('*** WARNING - Your figure is None. It most likely means your did not Finalize your Window ***')
print('Call Window.Finalize() prior to all graph operations') print('Call Window.Finalize() prior to all graph operations')
return None return None
figure.empty() # figure.empty()
cur_x = float(figure.attributes['x']) cur_x = float(figure.attributes['x'])
cur_y = float(figure.attributes['y']) cur_y = float(figure.attributes['y'])
figure.set_position(cur_x - x_direction,cur_y - y_direction) figure.set_position(cur_x - x_direction,cur_y - y_direction)
figure.redraw() figure.redraw()
def RelocateFigure(self, figure, x, y):
figure = figure #type: remi.gui.SvgCircle
zero_converted = self._convert_xy_to_canvas_xy(0, 0)
shift_converted = self._convert_xy_to_canvas_xy(x, y)
shift_amount = (shift_converted[0] - zero_converted[0], shift_converted[1] - zero_converted[1])
if figure is None:
print('*** WARNING - Your figure is None. It most likely means your did not Finalize your Window ***')
print('Call Window.Finalize() prior to all graph operations')
return None
# figure.empty()
figure.set_position(shift_converted[0], shift_converted[1])
figure.redraw()
@property @property
def TKCanvas(self): def TKCanvas(self):
if self._TKCanvas2 is None: if self._TKCanvas2 is None:
@ -3299,7 +3344,7 @@ class Window:
self.master_widget = None self.master_widget = None
self.window.App = self self.window.App = self
if userdata2 is None: if userdata2 is None:
res_path = os.path.dirname(os.path.abspath(__file__)) # res_path = os.path.dirname(os.path.abspath(__file__))
# print('res path', res_path) # print('res path', res_path)
super(Window.MyApp, self).__init__(*args, static_file_path={'C':'c:','c':'c:','D':'d:', 'd':'d:', 'E':'e:', 'e':'e:', 'dot':'.', '.':'.'}) super(Window.MyApp, self).__init__(*args, static_file_path={'C':'c:','c':'c:','D':'d:', 'd':'d:', 'E':'e:', 'e':'e:', 'dot':'.', '.':'.'})
@ -3395,6 +3440,7 @@ def base64_to_style_image(base64_image):
x ="url('data:image/png;base64," x ="url('data:image/png;base64,"
x += str(base64_image) x += str(base64_image)
x += "')" x += "')"
print(x)
return x return x
@ -4551,7 +4597,7 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form):
elif element_type == ELEM_TYPE_IMAGE: elif element_type == ELEM_TYPE_IMAGE:
element = element # type: Image element = element # type: Image
# element.Widget = remi.gui.Image(element.Filename) # element.Widget = remi.gui.Image(element.Filename)
element.Widget = SuperImage(element.Filename) element.Widget = SuperImage(element.Filename if element.Filename is not None else element.Data)
do_font_and_color(element.Widget) do_font_and_color(element.Widget)
if element.EnableEvents: if element.EnableEvents:
element.Widget.onclick.connect(element.ChangedCallback) element.Widget.onclick.connect(element.ChangedCallback)
@ -4603,6 +4649,8 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form):
elif element_type == ELEM_TYPE_GRAPH: elif element_type == ELEM_TYPE_GRAPH:
element = element # type: Graph element = element # type: Graph
element.Widget = remi.gui.Svg(width=element.CanvasSize[0], height=element.CanvasSize[1]) element.Widget = remi.gui.Svg(width=element.CanvasSize[0], height=element.CanvasSize[1])
element.SvgGroup = remi.gui.SvgGroup(0,0)
element.Widget.append([element.SvgGroup,])
do_font_and_color(element.Widget) do_font_and_color(element.Widget)
if element.ChangeSubmits: if element.ChangeSubmits:
element.Widget.onclick.connect(element.ChangedCallback) element.Widget.onclick.connect(element.ChangedCallback)
@ -6698,6 +6746,8 @@ def main():
[Combo(values=['Combo 1', 'Combo 2', 'Combo 3'], default_value='Combo 2', key='_COMBO_', enable_events=True, [Combo(values=['Combo 1', 'Combo 2', 'Combo 3'], default_value='Combo 2', key='_COMBO_', enable_events=True,
readonly=False, tooltip='Combo box', disabled=False, size=(12, 1))], readonly=False, tooltip='Combo box', disabled=False, size=(12, 1))],
[Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), enable_events =True, size=(10, 3), key='_LIST_')], [Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), enable_events =True, size=(10, 3), key='_LIST_')],
[Image(filename=r'C:\Python\PycharmProjects\GooeyGUI\logo200.png', enable_events=True)],
[Image(data=DEFAULT_BASE64_ICON)],
[Slider((1, 100), default_value=80, key='_SLIDER_', visible=True, enable_events=True, orientation='v')], [Slider((1, 100), default_value=80, key='_SLIDER_', visible=True, enable_events=True, orientation='v')],
[Spin(values=(1, 2, 3), initial_value='2', size=(4, 1), key='_SPIN_', enable_events=True)], [Spin(values=(1, 2, 3), initial_value='2', size=(4, 1), key='_SPIN_', enable_events=True)],
[OK(), Button('Hidden', visible=False, key='_HIDDEN_'), Button('Values'), Button('Exit', button_color=('white', 'red')), Button('UnHide')] [OK(), Button('Hidden', visible=False, key='_HIDDEN_'), Button('Values'), Button('Exit', button_color=('white', 'red')), Button('UnHide')]

View File

@ -8,7 +8,7 @@
![Python Version](https://img.shields.io/badge/Python-3.x-yellow.svg) ![Python Version](https://img.shields.io/badge/Python-3.x-yellow.svg)
![Python Version](https://img.shields.io/badge/PySimpleGUIWeb_-0.22.0-orange.svg?longCache=true&style=for-the-badge) ![Python Version](https://img.shields.io/badge/PySimpleGUIWeb_-0.23.0-orange.svg?longCache=true&style=for-the-badge)
@ -297,6 +297,26 @@ New features
* NEW Window parameter layout so can skip calling Layout * NEW Window parameter layout so can skip calling Layout
## 0.23.0 21-Apr-2019 PySimpleGUIWeb
* GRAPH ELEMENT almost done!
* DrawLine
* DrawRectangle
* DrawPoint
* DrawCicle
* DrawText
* Erase
* Move
* MoveFigure (by a delta amount)
* RelocateFigure (draw to a new spot)
* Update - for background color change
* Enable events works for single clicks (no drags yet)
* Changed Image element to use SuperImage class
* Image element works better?
* Base64 not yet working
# Design # Design
# Author # Author
Mike B. Mike B.
@ -307,6 +327,7 @@ New features
# Acknowledgments # Acknowledgments
<!--stackedit_data: <!--stackedit_data:
eyJoaXN0b3J5IjpbLTExNjY3MTk5MTcsNDc1ODY1Njc2LC0xMD eyJoaXN0b3J5IjpbNDU1NTc2Mjg4LC0xMTY2NzE5OTE3LDQ3NT
U3MTAzNjQzLDEyMTMzNTI2MzYsLTExNjA2ODQzMzldfQ== g2NTY3NiwtMTA1NzEwMzY0MywxMjEzMzUyNjM2LC0xMTYwNjg0
MzM5XX0=
--> -->

View File

@ -7,7 +7,7 @@
![Python Version](https://img.shields.io/badge/Python-3.x-yellow.svg) ![Python Version](https://img.shields.io/badge/Python-3.x-yellow.svg)
![Python Version](https://img.shields.io/badge/PySimpleGUIWx_For_Python_3.x_Version-0.11.0-orange.svg?longCache=true&style=for-the-badge) ![Python Version](https://img.shields.io/badge/PySimpleGUIWx_For_Python_3.x_Version-0..0-orange.svg?longCache=true&style=for-the-badge)
@ -376,5 +376,6 @@ Starting with release 0.4.0, most of the Popup functions work. This means you c
# Acknowledgments # Acknowledgments
<!--stackedit_data: <!--stackedit_data:
eyJoaXN0b3J5IjpbLTIxNDIwNTI0ODQsODg2MzA1Mjk2XX0= eyJoaXN0b3J5IjpbLTEyMzExNjg0MDAsLTIxNDIwNTI0ODQsOD
g2MzA1Mjk2XX0=
--> -->

View File

@ -33,15 +33,15 @@
![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_3.x_Version-3.28.0-red.svg?longCache=true&style=for-the-badge) ![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_3.x_Version-3.2.0-red.svg?longCache=true&style=for-the-badge)
![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_2.7_Version-1.28.0-blue.svg?longCache=true&style=for-the-badge) ![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_2.7_Version-1.2.0-blue.svg?longCache=true&style=for-the-badge)
![Python Version](https://img.shields.io/badge/PySimpleGUIQt_Version-0.26.0-orange.svg?longCache=true&style=for-the-badge) ![Python Version](https://img.shields.io/badge/PySimpleGUIQt_Version-0..0-orange.svg?longCache=true&style=for-the-badge)
![Python Version](https://img.shields.io/badge/PySimpleGUIWx_version-0.11.0-orange.svg?longCache=true&style=for-the-badge) ![Python Version](https://img.shields.io/badge/PySimpleGUIWx_version-0..0-orange.svg?longCache=true&style=for-the-badge)
![Python Version](https://img.shields.io/badge/PySimpleGUIWeb_Version-0.22.0-orange.svg?longCache=true&style=for-the-badge) ![Python Version](https://img.shields.io/badge/PySimpleGUIWeb_Version-0.2218.0-orange.svg?longCache=true&style=for-the-badge)
[Announcements of Latest Developments](https://github.com/MikeTheWatchGuy/PySimpleGUI/issues/142) [Announcements of Latest Developments](https://github.com/MikeTheWatchGuy/PySimpleGUI/issues/142)
@ -4985,10 +4985,10 @@ GNU Lesser General Public License (LGPL 3) +
#### SORRY!! Will add these back. Lost due to file length limitation #### SORRY!! Will add these back. Lost due to file length limitation
<!--stackedit_data: <!--stackedit_data:
eyJoaXN0b3J5IjpbODY0OTc4NzY1LC0xMDY1OTc4MTI2LDUxOT eyJoaXN0b3J5IjpbODAxMDU0ODkzLDg2NDk3ODc2NSwtMTA2NT
A1NTk0LDIwNTMxMjUxNDksLTE1Nzg3NDY1ODgsMjYwNTg0ODE0 k3ODEyNiw1MTkwNTU5NCwyMDUzMTI1MTQ5LC0xNTc4NzQ2NTg4
LDExMDIwODgzMzMsMTY3OTg1MDk5MiwtMTQ2MTQyODEsLTYwNj LDI2MDU4NDgxNCwxMTAyMDg4MzMzLDE2Nzk4NTA5OTIsLTE0Nj
M3MTE4LC01MDkzNTkxMjMsLTI0ODk3NjI5LDEzMDc2OTI1OSwt E0MjgxLC02MDYzNzExOCwtNTA5MzU5MTIzLC0yNDg5NzYyOSwx
Mjk2NzgzNTUsLTc3NDA3NDIzMCwyNjYzNjQ0MTcsNDQ5NDMzMj MzA3NjkyNTksLTI5Njc4MzU1LC03NzQwNzQyMzAsMjY2MzY0ND
QzLC0xMTQ4NDkwNjIzXX0= E3LDQ0OTQzMzI0MywtMTE0ODQ5MDYyM119
--> -->

View File

@ -33,15 +33,15 @@
![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_3.x_Version-3.28.0-red.svg?longCache=true&style=for-the-badge) ![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_3.x_Version-3.29.0-red.svg?longCache=true&style=for-the-badge)
![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_2.7_Version-1.28.0-blue.svg?longCache=true&style=for-the-badge) ![Python Version](https://img.shields.io/badge/PySimpleGUI_For_Python_2.7_Version-1.29.0-blue.svg?longCache=true&style=for-the-badge)
![Python Version](https://img.shields.io/badge/PySimpleGUIQt_Version-0.26.0-orange.svg?longCache=true&style=for-the-badge) ![Python Version](https://img.shields.io/badge/PySimpleGUIQt_Version-0.26.0-orange.svg?longCache=true&style=for-the-badge)
![Python Version](https://img.shields.io/badge/PySimpleGUIWx_version-0.11.0-orange.svg?longCache=true&style=for-the-badge) ![Python Version](https://img.shields.io/badge/PySimpleGUIWx_version-0..0-orange.svg?longCache=true&style=for-the-badge)
![Python Version](https://img.shields.io/badge/PySimpleGUIWeb_Version-0.22.0-orange.svg?longCache=true&style=for-the-badge) ![Python Version](https://img.shields.io/badge/PySimpleGUIWeb_Version-0.2218.0-orange.svg?longCache=true&style=for-the-badge)
[Announcements of Latest Developments](https://github.com/MikeTheWatchGuy/PySimpleGUI/issues/142) [Announcements of Latest Developments](https://github.com/MikeTheWatchGuy/PySimpleGUI/issues/142)
@ -3095,6 +3095,7 @@ After you supply those values you can scribble all of over your graph by creatin
* DrawPoint * DrawPoint
* DrawRectangle * DrawRectangle
* DrawOval * DrawOval
* DrawImage
You can move your figures around on the canvas by supplying the Figure ID the x,y amount to move. You can move your figures around on the canvas by supplying the Figure ID the x,y amount to move.
@ -3130,7 +3131,8 @@ Erase(background_color)
DeleteFigure(figure_id) DeleteFigure(figure_id)
Update() Update()
Move(self, x_direction, y_direction) Move(self, x_direction, y_direction)
MoveFigure(self, figure, x_direction, y_direction) MoveFigure(self, figure, x_direction, y_direction)
RelocateFigure(self, figure, x, y)
TKCanvas TKCanvas
``` ```
All of the Drawing methods return a "***figure***" that can be used move and delete the figure All of the Drawing methods return a "***figure***" that can be used move and delete the figure
@ -3142,10 +3144,12 @@ DrawOval - draws an oval
DrawArc - draws an arc DrawArc - draws an arc
DrawRectangle - draws a rectangle DrawRectangle - draws a rectangle
DrawText - draws text DrawText - draws text
DrawImage - places an image onto the graph
Erase - erases entire graph Erase - erases entire graph
Update - changes background color Update - changes background color
Move - moves everything an x,y direction Move - moves everything an x,y direction
MoveFigure - moves an individual figure MoveFigure - moves an individual figure by some delta
RelocateFigure - moves figure to an absolute location
DeleteFigure - delete an individual figure DeleteFigure - delete an individual figure
@ -4882,7 +4886,7 @@ Emergency patch release... going out same day as previous release
* Combobox Styling (again) * Combobox Styling (again)
# 3.23.0 PySimpleGUI / 1.23.0 PySimpleGUI27 16-Jan-2019 # 3.2.0 PySimpleGUI / 1.23.0 PySimpleGUI27 16-Jan-2019
* Animated GIFs! * Animated GIFs!
* Calendar Chooser stays on top of other windows * Calendar Chooser stays on top of other windows
@ -4925,14 +4929,15 @@ Mixup.... 3.26 changes don't appear to have been correctly released so releasing
* Convert button text to string when creating buttons * Convert button text to string when creating buttons
* Buttons are returned now as well as input fields when searching for element with focus * Buttons are returned now as well as input fields when searching for element with focus
## 3.29 22-Apr-2019
* New method for `Graph` - `RelocateFigure`
* Output Element no longer accepts focus
### Upcoming ### Upcoming
Make suggestions people! Future release features Make suggestions people! Future release features
Port to other graphic engines. Hook up the front-end interface to a backend other than tkinter. Qt, WxPython, etc. At the moment, Wx and Kivy are being considered for the next GUI framework. Work has already begun on Wx. Kivy is likely to be next instead of Wx however.
## Code Condition ## Code Condition
Make it run Make it run
@ -4971,10 +4976,9 @@ tkinter is the "official" GUI that Python supports. It runs on Windows, Linux,
From the start of the PSG project, tkinter was not meant to be the only underlying GUI framework for PySimpleGUI. It is merely a starting point. All journeys begin with one step forward and choosing tkinter was the first of many steps for PySimpleGUI. Now there are 4 ports up and running - tkinter, WxPython, Qt and Remi (web support) From the start of the PSG project, tkinter was not meant to be the only underlying GUI framework for PySimpleGUI. It is merely a starting point. All journeys begin with one step forward and choosing tkinter was the first of many steps for PySimpleGUI. Now there are 4 ports up and running - tkinter, WxPython, Qt and Remi (web support)
## Author ## Author
MikeB Mike - who wrote PySimpleGUI is not important. It's the software that's important
## License ## License
@ -4985,10 +4989,10 @@ GNU Lesser General Public License (LGPL 3) +
#### SORRY!! Will add these back. Lost due to file length limitation #### SORRY!! Will add these back. Lost due to file length limitation
<!--stackedit_data: <!--stackedit_data:
eyJoaXN0b3J5IjpbODY0OTc4NzY1LC0xMDY1OTc4MTI2LDUxOT eyJoaXN0b3J5IjpbMTIxNjg5MDM1Niw4NjQ5Nzg3NjUsLTEwNj
A1NTk0LDIwNTMxMjUxNDksLTE1Nzg3NDY1ODgsMjYwNTg0ODE0 U5NzgxMjYsNTE5MDU1OTQsMjA1MzEyNTE0OSwtMTU3ODc0NjU4
LDExMDIwODgzMzMsMTY3OTg1MDk5MiwtMTQ2MTQyODEsLTYwNj OCwyNjA1ODQ4MTQsMTEwMjA4ODMzMywxNjc5ODUwOTkyLC0xND
M3MTE4LC01MDkzNTkxMjMsLTI0ODk3NjI5LDEzMDc2OTI1OSwt YxNDI4MSwtNjA2MzcxMTgsLTUwOTM1OTEyMywtMjQ4OTc2Mjks
Mjk2NzgzNTUsLTc3NDA3NDIzMCwyNjYzNjQ0MTcsNDQ5NDMzMj MTMwNzY5MjU5LC0yOTY3ODM1NSwtNzc0MDc0MjMwLDI2NjM2ND
QzLC0xMTQ4NDkwNjIzXX0= QxNyw0NDk0MzMyNDMsLTExNDg0OTA2MjNdfQ==
--> -->