SDK Reference - changed to inspect.getfullargspec because inspect.getargspec is not supported in 3.11

This commit is contained in:
PySimpleGUI 2021-11-10 12:04:35 -05:00
parent 3621ba71e7
commit cf2f99c8d8
1 changed files with 75 additions and 72 deletions

View File

@ -1,12 +1,14 @@
#!/usr/bin/python3
version = __version__ = "4.55.1.1 Released 7-Nov-2021"
version = __version__ = "4.55.1.2 Unreleased"
_change_log = """
Changelog since 4.55.1 released to PyPI on 7-Nov-2021
4.55.1.1
Addition of stdin parm to execute_command_subprocess. This is to fix problem when pyinstaller is used to make an EXE from a psg program that calls this function
4.55.1.2
Changed getargspec call in the SDK Reference window to getfullargspec. In 3.11 getargspec is no longer supported and thus crashes
Added try to SDK Reference event loop to catch any additional problems that may pop up in 3.11
"""
__version__ = version.split()[0] # For PEP 396 and PEP 345
@ -169,11 +171,10 @@ try:
except:
webbrowser_available = False
# used for github upgrades
import sys
import urllib.request
import urllib.error
import urllib.parse
import pydoc
from urllib import request
import os
import sys
@ -22546,8 +22547,8 @@ def main_sdk_help():
for element in element_classes:
# Build info about init method
args = inspect.getargspec(element.__init__).args[1:]
defaults = inspect.getargspec(element.__init__).defaults
args = inspect.getfullargspec(element.__init__).args[1:]
defaults = inspect.getfullargspec(element.__init__).defaults
# print('------------- {element}----------')
# print(args)
# print(defaults)
@ -22561,8 +22562,8 @@ def main_sdk_help():
# Build info about update method
try:
args = inspect.getargspec(element.update).args[1:]
defaults = inspect.getargspec(element.update).defaults
args = inspect.getfullargspec(element.update).args[1:]
defaults = inspect.getfullargspec(element.update).defaults
if args is None or defaults is None:
element_arg_default_dict_update[element.__name__] = (('', ''),)
continue
@ -22594,6 +22595,7 @@ def main_sdk_help():
online_help_link = ''
ml = window['-ML-']
current_element = ''
try:
while True: # Event Loop
event, values = window.read()
if event in (WIN_CLOSED, 'Exit'):
@ -22611,7 +22613,7 @@ def main_sdk_help():
window['-DOC LINK-'].update(online_help_link)
if not values['-SUMMARY-']:
elem = element_names[event]
ml.print(help(elem))
ml.print(pydoc.help(elem))
# print the aliases for the class
ml.print('\n--- Shortcut Aliases for Class ---')
for v in vars3:
@ -22661,9 +22663,10 @@ def main_sdk_help():
ml.print(f)
else:
ml.print('=========== ' + f + '===========', background_color='#FFFF00', text_color='black')
ml.print(help(f_entry[1]))
ml.print(pydoc.help(f_entry[1]))
ml.set_vscroll_position(0) # scroll to top of multoline
except Exception as e:
_error_popup_with_traceback('Exception in SDK reference', e)
window.close()