Release 4.37.0

This commit is contained in:
PySimpleGUI 2021-03-15 16:39:00 -04:00
parent 3e411d9853
commit bf764aa1e1
6 changed files with 161 additions and 51 deletions

View File

@ -1,5 +1,5 @@
#!/usr/bin/python3
version = __version__ = "4.36.0.1 UnReleased\nExec APIS - new function to see if subproceses is still running, more paramters to control the output for subprocesses"
version = __version__ = "4.37.0 Released 15-Mar-2021"
__version__ = version.split()[0] # For PEP 396 and PEP 345
@ -226,7 +226,7 @@ def _timeit_summary(func):
return wrapper
def _running_linux():
def running_linux():
"""
Determines the OS is Linux by using sys.platform
@ -238,7 +238,7 @@ def _running_linux():
return sys.platform.startswith('linux')
def _running_mac():
def running_mac():
"""
Determines the OS is Mac by using sys.platform
@ -250,7 +250,7 @@ def _running_mac():
return sys.platform.startswith('darwin')
def _running_windows():
def running_windows():
"""
Determines the OS is Windows by using sys.platform
@ -262,7 +262,7 @@ def _running_windows():
return sys.platform.startswith('win')
def _running_trinket():
def running_trinket():
"""
A special case for Trinket. Checks both the OS and the number of environment variables
Currently, Trinket only has ONE environment variable. This fact is used to figure out if Trinket is being used.
@ -274,7 +274,6 @@ def _running_trinket():
"""
if len(os.environ) == 1 and sys.platform.startswith('linux'):
return True
return False
@ -900,7 +899,7 @@ class Element():
# If this is a minimize button for a custom titlebar, then minimize the window
if self.Key == TITLEBAR_MINIMIZE_KEY:
# if sys.platform == 'linux':
if _running_linux():
if running_linux():
print('* linix minimize *')
self.ParentForm.TKroot.wm_attributes("-type", "normal")
# self.ParentForm.TKroot.state('icon')
@ -930,7 +929,7 @@ class Element():
def _titlebar_restore(self, event):
# if sys.platform == 'linux':
if _running_linux():
if running_linux():
print('linux restore')
# if self._skip_first_restore_callback:
# self._skip_first_restore_callback = False
@ -9309,7 +9308,7 @@ class Window:
if not self._is_window_created():
return
if _running_mac():
if running_mac():
return
try:
@ -17841,7 +17840,7 @@ def execute_py_file(pyfile, parms=None, cwd=None, interpreter_command=None, wait
else:
python_program = pysimplegui_user_settings.get('-python command-', '')
if python_program == '':
python_program = 'python' if _running_windows() else 'python3'
python_program = 'python' if running_windows() else 'python3'
if parms is not None and python_program:
sp = execute_command_subprocess(python_program, pyfile, parms, wait=wait, cwd=cwd, pipe_output=pipe_output)
elif python_program:
@ -18705,7 +18704,7 @@ def _copy_files_from_github(files, github_url=None):
page_contents["__init__.py"] = ("from ." + info.package + " import *\n").encode()
if version != "unknown":
page_contents["__init__.py"] += ("from ." + info.package + " import __version__\n").encode()
if _running_linux() or _running_mac():
if running_linux() or running_mac():
dir_search = sys.path
else:
dir_search = site.getsitepackages()
@ -18730,7 +18729,7 @@ def _copy_files_from_github(files, github_url=None):
with open(os.path.join(str(path), str(file)), "wb") as f:
f.write(contents)
if _running_mac():
if running_mac():
pypi_packages = str(sitepackages_path) + "/.pypi_packages"
config = configparser.ConfigParser()
config.read(pypi_packages)
@ -19425,7 +19424,7 @@ pysimplegui_user_settings = UserSettings(filename=DEFAULT_USER_SETTINGS_PYSIMPLE
theme(theme_global())
# See if running on Trinket. If Trinket, then use custom titlebars since Trinket doesn't supply any
if _running_trinket():
if running_trinket():
USE_CUSTOM_TITLEBAR = True
if tclversion_detailed.startswith('8.5'):

View File

@ -3654,8 +3654,8 @@ Parameter Descriptions:
|Type|Name|Meaning|
|--|--|--|
| str or bytes | source | Filename or Base64 encoded string containing Animated GIF |
| int | time_between_frames | Number of milliseconds to wait between showing frames |
| str or bytes or None | source | Filename or Base64 encoded string containing Animated GIF |
| int | time_between_frames | Number of milliseconds to wait between showing frames |
### update_animation_no_buffering
@ -3752,8 +3752,8 @@ Parameter Descriptions:
|Type|Name|Meaning|
|--|--|--|
| str or bytes | source | Filename or Base64 encoded string containing Animated GIF |
| int | time_between_frames | Number of milliseconds to wait between showing frames |
| str or bytes or None | source | Filename or Base64 encoded string containing Animated GIF |
| int | time_between_frames | Number of milliseconds to wait between showing frames |
---------
@ -4791,6 +4791,7 @@ Multiline(default_text = "",
pad = None,
tooltip = None,
justification = None,
scrollbar = True,
right_click_menu = None,
visible = True,
metadata = None)
@ -4825,6 +4826,7 @@ Parameter Descriptions:
| (int, int or (int, int),(int,int) or int,(int,int)) or ((int, int),int) | pad | Amount of padding to put around element (left/right, top/bottom) or ((left, right), (top, bottom)) |
| str | tooltip | text, that will appear when mouse hovers over the element |
| str | justification | text justification. left, right, center. Can use single characters l, r, c. |
| bool | scrollbar | If True then a scrollbar will be shown (the default) |
| List[List[ List[str] or str ]] | right_click_menu | A list of lists of Menu items to show when this element is right clicked. See user docs for exact format. |
| bool | visible | set visibility state of the element |
| Any | metadata | User metadata that can be set to ANYTHING |
@ -12779,7 +12781,7 @@ Parameter Descriptions:
| str | transparent_color | This color will be completely see-through in your window. Can even click through |
| str | title | Title that will be shown on the window |
| str | icon | Same as Window icon parameter. Can be either a filename or Base64 value. For Windows if filename, it MUST be ICO format. For Linux, must NOT be ICO |
| None | **RETURN** | No return value
| bool | **RETURN** | True if the window updated OK. False if the window was closed
Popup that closes itself after some time period
@ -13727,7 +13729,7 @@ Parameter Descriptions:
| str | transparent_color | This color will be completely see-through in your window. Can even click through |
| str | title | Title that will be shown on the window |
| str | icon | Same as Window icon parameter. Can be either a filename or Base64 value. For Windows if filename, it MUST be ICO format. For Linux, must NOT be ICO |
| None | **RETURN** | No return value
| bool | **RETURN** | True if the window updated OK. False if the window was closed
Display a Popup without a titlebar. Enables grab anywhere so you can move it
@ -15185,17 +15187,19 @@ Returns a subprocess Popen object.
execute_command_subprocess(command,
args=*<1 or N object>,
wait = False,
cwd = None)
cwd = None,
pipe_output = False)
```
Parameter Descriptions:
|Type|Name|Meaning|
|--|--|--|
| str | command | Filename to load settings from (and save to in the future) |
| Any | *args | Variable number of arguments that are passed to the program being started as command line parms |
| bool | wait | If True then wait for the subprocess to finish |
| str | cwd | Working directory to use when executing the subprocess |
| str | command | Filename to load settings from (and save to in the future) |
| Any | *args | Variable number of arguments that are passed to the program being started as command line parms |
| bool | wait | If True then wait for the subprocess to finish |
| str | cwd | Working directory to use when executing the subprocess |
| bool | pipe_output | If True then output from the subprocess will be piped. You MUST empty the pipe by calling execute_get_results or your subprocess will block until no longer full |
| (subprocess.Popen) | **RETURN** | Popen object
Runs the editor that was configured in the global settings and opens the file to a specific line number.
@ -15236,7 +15240,7 @@ Get the text results of a previously executed execute call
Returns a tuple of the strings (stdout, stderr)
```
execute_get_results(subprocess_id)
execute_get_results(subprocess_id, timeout = None)
```
Parameter Descriptions:
@ -15244,6 +15248,7 @@ Parameter Descriptions:
|Type|Name|Meaning|
|--|--|--|
| (subprocess.Popen) | subprocess_id | a Popen subprocess ID returned from a previous execute call |
| (None or float) | timeout | Time in fractions of a second to wait. Returns '','' if timeout. Default of None means wait forever |
Executes a Python file.
The interpreter to use is chosen based on this priority order:
@ -15256,18 +15261,20 @@ execute_py_file(pyfile,
parms = None,
cwd = None,
interpreter_command = None,
wait = False)
wait = False,
pipe_output = False)
```
Parameter Descriptions:
|Type|Name|Meaning|
|--|--|--|
| str | pyfile | the file to run |
| | parms | parameters to pass on the command line |
| | cwd | the working directory to use |
| | interpreter_command | the command used to invoke the Python interpreter |
| | wait | the working directory to use |
| str | pyfile | the file to run |
| str | parms | parameters to pass on the command line |
| str | cwd | the working directory to use |
| str | interpreter_command | the command used to invoke the Python interpreter |
| bool | wait | the working directory to use |
| bool | pipe_output | If True then output from the subprocess will be piped. You MUST empty the pipe by calling execute_get_results or your subprocess will block until no longer full |
| (subprocess.Popen) or None | **RETURN** | Popen object
## Misc

View File

@ -1821,7 +1821,7 @@ Parameter Descriptions:
| str | transparent_color | This color will be completely see-through in your window. Can even click through |
| str | title | Title that will be shown on the window |
| str | icon | Same as Window icon parameter. Can be either a filename or Base64 value. For Windows if filename, it MUST be ICO format. For Linux, must NOT be ICO |
| None | **RETURN** | No return value
| bool | **RETURN** | True if the window updated OK. False if the window was closed
***To close animated popups***, call PopupAnimated with `image_source=None`. This will close all of the currently open PopupAnimated windows.
@ -8428,6 +8428,39 @@ Emojis, Global settings, Exec APIs
* Element.set_cursor
* now has a color parameter to set the color of the BEAM for input and other elements like them
## 4.36.0 PySimpleGUI 14-Mar-2021
Happy Pi Day!
Exec APIs 1.1, some others fixes too
* Exec APIs
* Fixed the Popen problems found in 3.8+
* Add quotes on all platforms now, not just Windows
* Added checks for COLOR_SYSTEM_DEFAULT to a number of the element .update mehtods
* Changed GreenTan theme to use black
* Fix for button update when cubsample used
* Changed image update anumiation to start & stop at correct frame
* Added return values for popup_animated
* Themes - gray or grey can be used to select the gray themes. Spelling doesn't matter now
* New scrollbar parm for Multiline Element - will use a Text Widget now if scrollbar is False
* New Text element class methods for measuring size of characters
* Debugger theme changed and red button removed
## 4.37.0 PySimpleGUI 15-Mar-2021
Happy "Pi with significant rounding error day"!
I'll eventually figure out this subprocess thing... honest...
* Exec APIs
* More control needed over routing of STDOUT
* Additional parm added pipe_output to execute_command_subprocess
* execute_get_results has a timeout parm now
* execute_subprocess_still_running added to check if a subprocess is still running
* Exposed the "running" functions so they can be used by Demos
* Used internally to see if running on Windows, Linux, Mac, Trinket
* Makes it one less import and the code already existed. All that needed to happen is the _ removed from the front of function name
## Upcoming
The future for PySimpleGUI looks bright!

View File

@ -1759,8 +1759,39 @@ Emojis, Global settings, Exec APIs
* now has a color parameter to set the color of the BEAM for input and other elements like them
## 4.36.0 PySimpleGUI 14-Mar-2021
Happy Pi Day!
Exec APIs 1.1, some others fixes too
* Exec APIs
* Fixed the Popen problems found in 3.8+
* Add quotes on all platforms now, not just Windows
* Added checks for COLOR_SYSTEM_DEFAULT to a number of the element .update mehtods
* Changed GreenTan theme to use black
* Fix for button update when cubsample used
* Changed image update anumiation to start & stop at correct frame
* Added return values for popup_animated
* Themes - gray or grey can be used to select the gray themes. Spelling doesn't matter now
* New scrollbar parm for Multiline Element - will use a Text Widget now if scrollbar is False
* New Text element class methods for measuring size of characters
* Debugger theme changed and red button removed
## 4.37.0 PySimpleGUI 15-Mar-2021
Happy "Pi with significant rounding error day"!
I'll eventually figure out this subprocess thing... honest...
* Exec APIs
* More control needed over routing of STDOUT
* Additional parm added pipe_output to execute_command_subprocess
* execute_get_results has a timeout parm now
* execute_subprocess_still_running added to check if a subprocess is still running
* Exposed the "running" functions so they can be used by Demos
* Used internally to see if running on Windows, Linux, Mac, Trinket
* Makes it one less import and the code already existed. All that needed to happen is the _ removed from the front of function name
## Upcoming

View File

@ -3654,8 +3654,8 @@ Parameter Descriptions:
|Type|Name|Meaning|
|--|--|--|
| str or bytes | source | Filename or Base64 encoded string containing Animated GIF |
| int | time_between_frames | Number of milliseconds to wait between showing frames |
| str or bytes or None | source | Filename or Base64 encoded string containing Animated GIF |
| int | time_between_frames | Number of milliseconds to wait between showing frames |
### update_animation_no_buffering
@ -3752,8 +3752,8 @@ Parameter Descriptions:
|Type|Name|Meaning|
|--|--|--|
| str or bytes | source | Filename or Base64 encoded string containing Animated GIF |
| int | time_between_frames | Number of milliseconds to wait between showing frames |
| str or bytes or None | source | Filename or Base64 encoded string containing Animated GIF |
| int | time_between_frames | Number of milliseconds to wait between showing frames |
---------
@ -4791,6 +4791,7 @@ Multiline(default_text = "",
pad = None,
tooltip = None,
justification = None,
scrollbar = True,
right_click_menu = None,
visible = True,
metadata = None)
@ -4825,6 +4826,7 @@ Parameter Descriptions:
| (int, int or (int, int),(int,int) or int,(int,int)) or ((int, int),int) | pad | Amount of padding to put around element (left/right, top/bottom) or ((left, right), (top, bottom)) |
| str | tooltip | text, that will appear when mouse hovers over the element |
| str | justification | text justification. left, right, center. Can use single characters l, r, c. |
| bool | scrollbar | If True then a scrollbar will be shown (the default) |
| List[List[ List[str] or str ]] | right_click_menu | A list of lists of Menu items to show when this element is right clicked. See user docs for exact format. |
| bool | visible | set visibility state of the element |
| Any | metadata | User metadata that can be set to ANYTHING |
@ -12779,7 +12781,7 @@ Parameter Descriptions:
| str | transparent_color | This color will be completely see-through in your window. Can even click through |
| str | title | Title that will be shown on the window |
| str | icon | Same as Window icon parameter. Can be either a filename or Base64 value. For Windows if filename, it MUST be ICO format. For Linux, must NOT be ICO |
| None | **RETURN** | No return value
| bool | **RETURN** | True if the window updated OK. False if the window was closed
Popup that closes itself after some time period
@ -13727,7 +13729,7 @@ Parameter Descriptions:
| str | transparent_color | This color will be completely see-through in your window. Can even click through |
| str | title | Title that will be shown on the window |
| str | icon | Same as Window icon parameter. Can be either a filename or Base64 value. For Windows if filename, it MUST be ICO format. For Linux, must NOT be ICO |
| None | **RETURN** | No return value
| bool | **RETURN** | True if the window updated OK. False if the window was closed
Display a Popup without a titlebar. Enables grab anywhere so you can move it
@ -15185,17 +15187,19 @@ Returns a subprocess Popen object.
execute_command_subprocess(command,
args=*<1 or N object>,
wait = False,
cwd = None)
cwd = None,
pipe_output = False)
```
Parameter Descriptions:
|Type|Name|Meaning|
|--|--|--|
| str | command | Filename to load settings from (and save to in the future) |
| Any | *args | Variable number of arguments that are passed to the program being started as command line parms |
| bool | wait | If True then wait for the subprocess to finish |
| str | cwd | Working directory to use when executing the subprocess |
| str | command | Filename to load settings from (and save to in the future) |
| Any | *args | Variable number of arguments that are passed to the program being started as command line parms |
| bool | wait | If True then wait for the subprocess to finish |
| str | cwd | Working directory to use when executing the subprocess |
| bool | pipe_output | If True then output from the subprocess will be piped. You MUST empty the pipe by calling execute_get_results or your subprocess will block until no longer full |
| (subprocess.Popen) | **RETURN** | Popen object
Runs the editor that was configured in the global settings and opens the file to a specific line number.
@ -15236,7 +15240,7 @@ Get the text results of a previously executed execute call
Returns a tuple of the strings (stdout, stderr)
```
execute_get_results(subprocess_id)
execute_get_results(subprocess_id, timeout = None)
```
Parameter Descriptions:
@ -15244,6 +15248,7 @@ Parameter Descriptions:
|Type|Name|Meaning|
|--|--|--|
| (subprocess.Popen) | subprocess_id | a Popen subprocess ID returned from a previous execute call |
| (None or float) | timeout | Time in fractions of a second to wait. Returns '','' if timeout. Default of None means wait forever |
Executes a Python file.
The interpreter to use is chosen based on this priority order:
@ -15256,18 +15261,20 @@ execute_py_file(pyfile,
parms = None,
cwd = None,
interpreter_command = None,
wait = False)
wait = False,
pipe_output = False)
```
Parameter Descriptions:
|Type|Name|Meaning|
|--|--|--|
| str | pyfile | the file to run |
| | parms | parameters to pass on the command line |
| | cwd | the working directory to use |
| | interpreter_command | the command used to invoke the Python interpreter |
| | wait | the working directory to use |
| str | pyfile | the file to run |
| str | parms | parameters to pass on the command line |
| str | cwd | the working directory to use |
| str | interpreter_command | the command used to invoke the Python interpreter |
| bool | wait | the working directory to use |
| bool | pipe_output | If True then output from the subprocess will be piped. You MUST empty the pipe by calling execute_get_results or your subprocess will block until no longer full |
| (subprocess.Popen) or None | **RETURN** | Popen object
## Misc

View File

@ -1821,7 +1821,7 @@ Parameter Descriptions:
| str | transparent_color | This color will be completely see-through in your window. Can even click through |
| str | title | Title that will be shown on the window |
| str | icon | Same as Window icon parameter. Can be either a filename or Base64 value. For Windows if filename, it MUST be ICO format. For Linux, must NOT be ICO |
| None | **RETURN** | No return value
| bool | **RETURN** | True if the window updated OK. False if the window was closed
***To close animated popups***, call PopupAnimated with `image_source=None`. This will close all of the currently open PopupAnimated windows.
@ -8428,6 +8428,39 @@ Emojis, Global settings, Exec APIs
* Element.set_cursor
* now has a color parameter to set the color of the BEAM for input and other elements like them
## 4.36.0 PySimpleGUI 14-Mar-2021
Happy Pi Day!
Exec APIs 1.1, some others fixes too
* Exec APIs
* Fixed the Popen problems found in 3.8+
* Add quotes on all platforms now, not just Windows
* Added checks for COLOR_SYSTEM_DEFAULT to a number of the element .update mehtods
* Changed GreenTan theme to use black
* Fix for button update when cubsample used
* Changed image update anumiation to start & stop at correct frame
* Added return values for popup_animated
* Themes - gray or grey can be used to select the gray themes. Spelling doesn't matter now
* New scrollbar parm for Multiline Element - will use a Text Widget now if scrollbar is False
* New Text element class methods for measuring size of characters
* Debugger theme changed and red button removed
## 4.37.0 PySimpleGUI 15-Mar-2021
Happy "Pi with significant rounding error day"!
I'll eventually figure out this subprocess thing... honest...
* Exec APIs
* More control needed over routing of STDOUT
* Additional parm added pipe_output to execute_command_subprocess
* execute_get_results has a timeout parm now
* execute_subprocess_still_running added to check if a subprocess is still running
* Exposed the "running" functions so they can be used by Demos
* Used internally to see if running on Windows, Linux, Mac, Trinket
* Makes it one less import and the code already existed. All that needed to happen is the _ removed from the front of function name
## Upcoming
The future for PySimpleGUI looks bright!