From 16d96109a70eb3f075b10b8d7b945a2e6029296a Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Wed, 8 May 2019 15:24:30 -0400 Subject: [PATCH 1/2] Ver 0.27.0 released --- PySimpleGUIWeb/PySimpleGUIWeb.py | 2 +- PySimpleGUIWeb/readme.md | 41 +++++++++++++++++++++++++++++++- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/PySimpleGUIWeb/PySimpleGUIWeb.py b/PySimpleGUIWeb/PySimpleGUIWeb.py index 08a42078..8a64efb2 100644 --- a/PySimpleGUIWeb/PySimpleGUIWeb.py +++ b/PySimpleGUIWeb/PySimpleGUIWeb.py @@ -1808,7 +1808,7 @@ class Graph(Element): return None return - def DrawRectangle(self, top_left, bottom_right, fill_color='black', line_color=None): + def DrawRectangle(self, top_left, bottom_right, fill_color='black', line_color='black'): 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]) if self.Widget is None: diff --git a/PySimpleGUIWeb/readme.md b/PySimpleGUIWeb/readme.md index 0005a110..b4f6c484 100644 --- a/PySimpleGUIWeb/readme.md +++ b/PySimpleGUIWeb/readme.md @@ -8,7 +8,7 @@ ![Python Version](https://img.shields.io/badge/Python-3.x-yellow.svg) -![Python Version](https://img.shields.io/badge/PySimpleGUIWeb_-0.24.0-orange.svg?longCache=true&style=for-the-badge) +![Python Version](https://img.shields.io/badge/PySimpleGUIWeb_-0.27.0-orange.svg?longCache=true&style=for-the-badge) @@ -87,6 +87,7 @@ PySimpleGUIWeb runs only on Python 3. Legacy Python (2.7) is not supported. * Multiline Input Element * Multiline Output Element * Output Element (redirect STDOUT) +* Graph Element (your canvas to paint on) * Table Element (yes, tables! even if limited) * Window background color * Element padding @@ -331,6 +332,44 @@ One-time patch to remove a debug print * Base64 support for Image Element +## 0.25.0 PySimpleGUIWeb 25-Apr-19 + +* DrawImage method WORKS! DrawImage now takes BOTH filenames and base64 variables +* Fix for DrawRectangle (wasn't passing the right parms) + +## 0.26.0 PySimpleGUIWeb 1-May-2019 + +* Combo - converts values into a list of strings +* Image.Update is working with both filename and base64 (but no size controls yet) +* Window - new parameter - return_key_down_events. Normally it's key up events that are returned from Read calls +* Returning keyboard input works! +* Turned off Remi Logging completely (may be a bad idea. can change it back) +* Rearranged code so that same code is used for first window and following windows +* Window disable_close parameter controls wether or not server keeps running after user disconnects + +## 0.27.0 PySimpleGUIWeb 8-May-2019 + +* Changed default icon from string to bytes +* New Text Update to match newer call parameters +* Added image_subsample, image_size parms to be backward compat. Note - not enabled +* SuperImage changes - load both base64 images and files +* Fix for DrawRectangle +* Added data parm to DrawImage +* Added DeleteFigure +* Tab Support + * Just barely beginning + * May or may not work +* Window new class variable - AllKeysDict + * Contains dictionary of all elements and keys + * Now used by FindElement / Element calls for quick lookup +* Fix for Column elements and rows that didn't line up. Changed tk_row_frame style +* Graph Element + * enable_events works + * drag events works + * click events works + + + # Design # Author From 73f0ebe02aee9f0070fb03d08a7935f43c77ebf8 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Thu, 9 May 2019 10:12:38 -0400 Subject: [PATCH 2/2] Correctly handle transparent rectangles. Make Crosswork demo run on Web. --- DemoPrograms/Demo_Crossword_Puzzle.py | 1 + PySimpleGUIWeb/PySimpleGUIWeb.py | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/DemoPrograms/Demo_Crossword_Puzzle.py b/DemoPrograms/Demo_Crossword_Puzzle.py index 9919b802..62dd7b4e 100644 --- a/DemoPrograms/Demo_Crossword_Puzzle.py +++ b/DemoPrograms/Demo_Crossword_Puzzle.py @@ -1,6 +1,7 @@ import sys if sys.version_info[0] >= 3: import PySimpleGUI as sg + # import PySimpleGUIWeb as sg # take your pick of ports. Runs on both else: import PySimpleGUI27 as sg import random diff --git a/PySimpleGUIWeb/PySimpleGUIWeb.py b/PySimpleGUIWeb/PySimpleGUIWeb.py index 8a64efb2..57f4ed74 100644 --- a/PySimpleGUIWeb/PySimpleGUIWeb.py +++ b/PySimpleGUIWeb/PySimpleGUIWeb.py @@ -757,6 +757,7 @@ class Listbox(Element): background_color=bg, text_color=fg, key=key, pad=pad, tooltip=tooltip, visible=visible, size_px=size_px) def Update(self, values=None, disabled=None, set_to_index=None,background_color=None, text_color=None, font=None, visible=None): + return if values is not None: self.Values = values self.Widget.set_value(values) @@ -1808,7 +1809,7 @@ class Graph(Element): return None return - def DrawRectangle(self, top_left, bottom_right, fill_color='black', line_color='black'): + def DrawRectangle(self, top_left, bottom_right, fill_color=None, line_color='black'): 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]) if self.Widget is None: @@ -1816,9 +1817,12 @@ class Graph(Element): print('Call Window.Finalize() prior to this operation') return None - rpoint = remi.gui.SvgRectangle(converted_top_left[0], converted_top_left[1], converted_bottom_right[0]-converted_top_left[0], converted_top_left[1] - converted_bottom_right[1]) + rpoint = remi.gui.SvgRectangle(converted_top_left[0], converted_top_left[1], abs(converted_bottom_right[0]-converted_top_left[0]), abs(converted_top_left[1] - converted_bottom_right[1])) rpoint.set_stroke(width=1, color=line_color) - rpoint.set_fill(fill_color) + if fill_color is not None: + rpoint.set_fill(fill_color) + else: + rpoint.set_fill('transparent') self.SvgGroup.append([rpoint,]) return rpoint @@ -4963,7 +4967,7 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form): elif element_type == ELEM_TYPE_INPUT_SLIDER: element = element # type: Slider orient = remi.gui.Widget.LAYOUT_HORIZONTAL if element.Orientation.lower().startswith('h') else remi.gui.Widget.LAYOUT_VERTICAL - element.Widget = remi.gui.Slider(layout_orientation = orient, default_value=element.DefaultValue, min=element.Range[0], max=element.Range[1],step=element.Resolution) + element.Widget = remi.gui.Slider(layout_orientation=orient, default_value=element.DefaultValue, min=element.Range[0], max=element.Range[1],step=element.Resolution) if element.DefaultValue: element.Widget.set_value(element.DefaultValue) # if element.Orientation.startswith('v'):