Show an error if None is specified as values parameter in Listbox element

This commit is contained in:
PySimpleGUI 2022-05-19 16:25:42 -04:00
parent 6ad6d6583f
commit 0ecc48f4f7
1 changed files with 6 additions and 1 deletions

View File

@ -1,6 +1,6 @@
#!/usr/bin/python3 #!/usr/bin/python3
version = __version__ = "4.60.0.4 Unreleased" version = __version__ = "4.60.0.5 Unreleased"
_change_log = """ _change_log = """
Changelog since 4.60.0 released to PyPI on 8-May-2022 Changelog since 4.60.0 released to PyPI on 8-May-2022
@ -18,6 +18,8 @@ _change_log = """
4.60.0.4 4.60.0.4
New location parameter option for Windows. Setting location=None tells PySimpleGUI to not set any location when window is created. It's up to the OS to decide. New location parameter option for Windows. Setting location=None tells PySimpleGUI to not set any location when window is created. It's up to the OS to decide.
The docstring for Window has been changed, but not all the other places (like popup). Want to make sure this works before making all those changes. The docstring for Window has been changed, but not all the other places (like popup). Want to make sure this works before making all those changes.
4.60.0.5
Added check for None invalid values parm when creating a Listbox element
""" """
__version__ = version.split()[0] # For PEP 396 and PEP 345 __version__ = version.split()[0] # For PEP 396 and PEP 345
@ -2500,6 +2502,9 @@ class Listbox(Element):
:type metadata: (Any) :type metadata: (Any)
""" """
if values is None:
_error_popup_with_traceback('Error in your Listbox definition - The values parameter cannot be None', 'Use an empty list if you want no values in your Listbox')
self.Values = values self.Values = values
self.DefaultValues = default_values self.DefaultValues = default_values
self.TKListbox = None self.TKListbox = None