Merge pull request #1137 from PySimpleGUI/Dev-latest

Dev latest
This commit is contained in:
MikeTheWatchGuy 2019-02-03 20:09:10 -05:00 committed by GitHub
commit 7a61e96f34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 44 additions and 46 deletions

View File

@ -477,7 +477,6 @@ class InputText(Element):
super().__init__(ELEM_TYPE_INPUT_TEXT, size=size, background_color=bg, text_color=fg, key=key, pad=pad, super().__init__(ELEM_TYPE_INPUT_TEXT, size=size, background_color=bg, text_color=fg, key=key, pad=pad,
font=font, tooltip=tooltip, visible=visible, size_px=size_px) font=font, tooltip=tooltip, visible=visible, size_px=size_px)
# def InputTextCallback(self, widget:remi.gui.TextInput, value, keycode):
def InputTextCallback(self,widget, key, keycode, ctrl, shift, alt): def InputTextCallback(self,widget, key, keycode, ctrl, shift, alt):
# print(f'text widget value = {widget.get_value()}') # print(f'text widget value = {widget.get_value()}')
# widget.set_value('') # widget.set_value('')
@ -490,23 +489,20 @@ class InputText(Element):
def Update(self, value=None, disabled=None): def Update(self, value=None, disabled=None):
if disabled is True:
self.TKEntry['state'] = 'disabled'
elif disabled is False:
self.TKEntry['state'] = 'normal'
if value is not None: if value is not None:
try: self.Widget.set_value(str(value))
self.TKStringVar.set(value) if disabled is True:
except: self.Widget.set_enabled(False)
pass elif disabled is False:
self.DefaultText = value self.Widget.set_enabled(True)
def Get(self): def Get(self):
return self.TKStringVar.get() return self.Widget.get_value()
def SetFocus(self): def SetFocus(self):
try: try:
self.TKEntry.focus_set() # TODO NOT IMPLEMENTED YET
pass
except: except:
pass pass
@ -4032,10 +4028,8 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form):
# ------------------------- COLUMN element ------------------------- # # ------------------------- COLUMN element ------------------------- #
if element_type == ELEM_TYPE_COLUMN: if element_type == ELEM_TYPE_COLUMN:
print('adding column')
element = element # type: Column element = element # type: Column
element.Widget = column_widget = remi.gui.VBox() element.Widget = column_widget = remi.gui.VBox()
if element.Justification.startswith('c'): if element.Justification.startswith('c'):
print('CENTERING') print('CENTERING')
column_widget.style['align-items'] = 'center' column_widget.style['align-items'] = 'center'
@ -4048,30 +4042,6 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form):
PackFormIntoFrame(element, column_widget, toplevel_form) PackFormIntoFrame(element, column_widget, toplevel_form)
tk_row_frame.append(element.Widget) tk_row_frame.append(element.Widget)
# if element.Scrollable:
# col_frame = TkScrollableFrame(tk_row_frame,
# element.VerticalScrollOnly) # do not use yet! not working
# PackFormIntoFrame(element, col_frame.TKFrame, toplevel_form)
# col_frame.TKFrame.update()
# if element.Size == (None, None): # if no size specified, use column width x column height/2
# col_frame.canvas.config(width=col_frame.TKFrame.winfo_reqwidth(),
# height=col_frame.TKFrame.winfo_reqheight() / 2)
# else:
# col_frame.canvas.config(width=element.Size[0], height=element.Size[1])
#
# if not element.BackgroundColor in (None, COLOR_SYSTEM_DEFAULT):
# col_frame.canvas.config(background=element.BackgroundColor)
# col_frame.TKFrame.config(background=element.BackgroundColor, borderwidth=0,
# highlightthickness=0)
# col_frame.config(background=element.BackgroundColor, borderwidth=0, highlightthickness=0)
# else:
# col_frame = tk.Frame(tk_row_frame)
# PackFormIntoFrame(element, col_frame, toplevel_form)
#
# col_frame.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1], expand=True, fill='both')
# if element.BackgroundColor != COLOR_SYSTEM_DEFAULT and element.BackgroundColor is not None:
# col_frame.configure(background=element.BackgroundColor, highlightbackground=element.BackgroundColor,
# highlightcolor=element.BackgroundColor)
# ------------------------- TEXT element ------------------------- # # ------------------------- TEXT element ------------------------- #
elif element_type == ELEM_TYPE_TEXT: elif element_type == ELEM_TYPE_TEXT:
element = element # type: Text element = element # type: Text
@ -4089,7 +4059,6 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form):
element.Widget.onclick.connect(element.ChangedCallback) element.Widget.onclick.connect(element.ChangedCallback)
tk_row_frame.append(element.Widget) tk_row_frame.append(element.Widget)
# ------------------------- BUTTON element ------------------------- # # ------------------------- BUTTON element ------------------------- #
elif element_type == ELEM_TYPE_BUTTON: elif element_type == ELEM_TYPE_BUTTON:
element = element # type: Button element = element # type: Button

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.5.0-orange.svg?longCache=true&style=for-the-badge) ![Python Version](https://img.shields.io/badge/PySimpleGUIWeb_-0.7.0-orange.svg?longCache=true&style=for-the-badge)
@ -31,7 +31,7 @@ This Readme is for information ***specific to*** the Web port of PySimpleGUI.
PySimpleGUIWeb enables you to run your PySimpleGUI programs in your web browser. It utilizes a package called Remi to achieve this amazing package. PySimpleGUIWeb enables you to run your PySimpleGUI programs in your web browser. It utilizes a package called Remi to achieve this amazing package.
## Engineering Pre-Release Version 0.5.0 ## Engineering Pre-Release Version 0.7.0
[Announcements of Latest Developments](https://github.com/MikeTheWatchGuy/PySimpleGUI/issues/142) [Announcements of Latest Developments](https://github.com/MikeTheWatchGuy/PySimpleGUI/issues/142)
@ -166,6 +166,15 @@ New features
* Autosize Button Text * Autosize Button Text
## 0.6.0 PySimpleGUIWeb 3-Feb-2019
* Changed Remi port to 0 so will always get a new free port
## 0.7.0 PySimpleGUIWeb 3-Feb-2019
* Completed `InputText.Update` method so that more demos can be run
# Design # Design
# Author # Author
Mike B. Mike B.

View File

@ -20,6 +20,12 @@ There is a short section in the Readme with instruction on installing PySimpleGU
If you like this Cookbook, then you'll LOVE the 100+ sample programs that are just like these. You'll find them in the GitHub at http://www.PySimpleGUI.com. These Recipes are simply several of those programs displayed in document format. If you like this Cookbook, then you'll LOVE the 100+ sample programs that are just like these. You'll find them in the GitHub at http://www.PySimpleGUI.com. These Recipes are simply several of those programs displayed in document format.
# Experimental repl.it Embedded Windows
You'll find a few of these Recipes are running in your browser window using PySimpleGUIWeb. They are included so that you can immediately play around with the SDK before installing one of the PySimpleGUI variants on your computer.
This is a new capability for PySimpleGUI that has only very recently been started. Only a few of the elements are operational using PySimpleGUIWeb. So, be prepared for some bugs. It's got a ways to go, but still seemed valuable to include.
# Copy these design patterns! # Copy these design patterns!
All of your PySimpleGUI programs will utilize one of these 2 design patterns depending on the type of window you're implementing. The two types of windows are: All of your PySimpleGUI programs will utilize one of these 2 design patterns depending on the type of window you're implementing. The two types of windows are:
@ -119,7 +125,7 @@ while True: # Event Loop
window.Close() window.Close()
``` ```
<iframe height="800px" width="100%" src="https://repl.it/@PySimpleGUI/Design-Pattern-2B-Persistent-Window-with-Updates?lite=false" scrolling="no" frameborder="no" allowtransparency="true" allowfullscreen="true" sandbox="allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-modals"></iframe>
# Simple Data Entry - Return Values As List # Simple Data Entry - Return Values As List
@ -146,6 +152,8 @@ Same GUI screen except the return values are in a list instead of a dictionary a
print(event, values[0], values[1], values[2]) print(event, values[0], values[1], values[2])
``` ```
<iframe height="800px" width="100%" src="https://repl.it/@PySimpleGUI/Cookbook-Return-Values-as-List?lite=true" scrolling="no" frameborder="no" allowtransparency="true" allowfullscreen="true" sandbox="allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-modals"></iframe>
# Simple data entry - Return Values As Dictionary # Simple data entry - Return Values As Dictionary
A simple GUI with default values. Results returned in a dictionary. A simple GUI with default values. Results returned in a dictionary.
@ -172,7 +180,11 @@ A simple GUI with default values. Results returned in a dictionary.
print(event, values['_NAME_'], values['_ADDRESS_'], values['_PHONE_']) print(event, values['_NAME_'], values['_ADDRESS_'], values['_PHONE_'])
``` ```
---------------------
<iframe height="800px" width="100%" src="https://repl.it/@PySimpleGUI/Cookbook-Return-Values-As-Dictionary?lite=true" scrolling="no" frameborder="no" allowtransparency="true" allowfullscreen="true" sandbox="allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-modals"></iframe>
-------
@ -334,6 +346,7 @@ while True:
window.FindElement('_OUTPUT_').Update('{:02d}:{:02d}.{:02d}'.format((i // 100) // 60, (i // 100) % 60, i % 100)) window.FindElement('_OUTPUT_').Update('{:02d}:{:02d}.{:02d}'.format((i // 100) // 60, (i // 100) % 60, i % 100))
``` ```
<iframe height="800px" width="100%" src="https://repl.it/@PySimpleGUI/Cookbook-Timer?lite=true" scrolling="no" frameborder="no" allowtransparency="true" allowfullscreen="true" sandbox="allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-modals"></iframe>
-------- --------
@ -782,6 +795,8 @@ while True: # Event Loop
window.Close() window.Close()
``` ```
<iframe height="800px" width="100%" src="https://repl.it/@PySimpleGUI/Cookbook-Compound-Element?lite=true" scrolling="no" frameborder="no" allowtransparency="true" allowfullscreen="true" sandbox="allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-modals"></iframe>
## Multiple Windows ## Multiple Windows
This recipe is a design pattern for multiple windows where the first window is not active while the second window is showing. The first window is hidden to discourage continued interaction. This recipe is a design pattern for multiple windows where the first window is not active while the second window is showing. The first window is hidden to discourage continued interaction.
@ -957,6 +972,9 @@ There are a number of features used in this Recipe including:
window.FindElement('input').Update(keys_entered) # change the window to reflect current key string window.FindElement('input').Update(keys_entered) # change the window to reflect current key string
``` ```
<iframe height="800px" width="100%" src="https://repl.it/@PySimpleGUI/Cookbook-Keypad-Touchscreen-Entry?lite=true" scrolling="no" frameborder="no" allowtransparency="true" allowfullscreen="true" sandbox="allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-modals"></iframe>
## Animated Matplotlib Graph ## Animated Matplotlib Graph
Use the Canvas Element to create an animated graph. The code is a bit tricky to follow, but if you know Matplotlib then this recipe shouldn't be too difficult to copy and modify. Use the Canvas Element to create an animated graph. The code is a bit tricky to follow, but if you know Matplotlib then this recipe shouldn't be too difficult to copy and modify.
@ -1533,6 +1551,8 @@ That's all... Run your `my_program.exe` file on the Windows machine of your choo
Your EXE file should run without creating a "shell window". Only the GUI window should show up on your taskbar. Your EXE file should run without creating a "shell window". Only the GUI window should show up on your taskbar.
<!--stackedit_data: <!--stackedit_data:
eyJoaXN0b3J5IjpbNzE3MDQ5NjYwLC02Nzk1NDk2NzUsLTMzOT eyJoaXN0b3J5IjpbLTEzNTc5NjUyNTUsLTk0Mjc2ODgzNywtMz
M3MTM1Ml19 UwNzA2ODE4LC0xOTgzMjAzNjMwLC0xMDAwMjc2OTU0LC0xNDAy
ODQwOTg2LDY2ODc4OTc0OSwtMTE3NDc5OTg5Miw3MTcwNDk2Nj
AsLTY3OTU0OTY3NSwtMzM5MzcxMzUyXX0=
--> -->