How to fix TypeError: cannot unpack non-iterable Button object

Gigetto Lai

I was writing my PySimpleGUI program and it (Still) does not load This is the error it gives me:

Traceback (most recent call last):
  File "D:\Python\Lavoro.py", line 89, in <module>
    event = window.read()
            ^^^^^^^^^^^^^
  File "D:\Python\venv\Lib\site-packages\PySimpleGUI\PySimpleGUI.py", line 10075, in read
    results = self._read(timeout=timeout, timeout_key=timeout_key)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Python\venv\Lib\site-packages\PySimpleGUI\PySimpleGUI.py", line 10146, in _read
    self._Show()
  File "D:\Python\venv\Lib\site-packages\PySimpleGUI\PySimpleGUI.py", line 9886, in _Show
    StartupTK(self)
  File "D:\Python\venv\Lib\site-packages\PySimpleGUI\PySimpleGUI.py", line 16866, in StartupTK
    _convert_window_to_tk(window)
  File "D:\Python\venv\Lib\site-packages\PySimpleGUI\PySimpleGUI.py", line 16753, in _convert_window_to_tk
    PackFormIntoFrame(window, master, window)
  File "D:\Python\venv\Lib\site-packages\PySimpleGUI\PySimpleGUI.py", line 14943, in PackFormIntoFrame
    width, height = element_size
    ^^^^^^^^^^^^^
TypeError: cannot unpack non-iterable Button object

This is the Code I Put ??? For privacy

layout = [ [sg.Text('???')],
           [sg.Text('???')],
           [sg.Text('???', sg.Button('???'))],
           [sg.Text('???')],
           [sg.Text('???')] ]

window = sg.Window('???', layout)

while True:
    event, values = window.read()

I tried using this

event = window.read
values = window.read

It didnt work so now im stuck here

Marko Borković

I am not sure what kind of layout you are going for but I believe this line:

[sg.Text('???', sg.Button('???'))],

should be

[sg.Text('???'), sg.Button('???')],

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

TypeError: cannot unpack non-iterable GetColorImage object

tensorflow TypeError: cannot unpack non-iterable float object

TypeError: cannot unpack non-iterable NoneType object

TypeError: cannot unpack non-iterable int object

Python Django: TypeError: cannot unpack non-iterable MatchAll object

TypeError at /cart/ cannot unpack non-iterable Cart object

TypeError: cannot unpack non-iterable bool object

Python: TypeError: cannot unpack non-iterable int object

Python TypeError: cannot unpack non-iterable bool object

Python / TypeError: cannot unpack non-iterable Jugador object

-- TypeError: cannot unpack non-iterable NoneType object

PyAutoGui TypeError: cannot unpack non-iterable NoneType object

TypeError: cannot unpack non-iterable int object (Python)

TypeError: cannot unpack non-iterable Lexer object

"TypeError: cannot unpack non-iterable int object" with filter function

TypeError: cannot unpack non-iterable NoneType object Error

How to fix "cannot unpack non-iterable NoneType object" error in django admin whilst using custom user model

Cannot unpack non-iterable object

How do I create a field in my serializer to avoid a "TypeError: cannot unpack non-iterable Address object" error?

(TypeError: cannot unpack non-iterable int object) for inversion counter using merge sort

TypeError: cannot unpack non-iterable int object in Django views function

I am getting a "TypeError: cannot unpack non-iterable int object"

Error iterating over a list 'TypeError: cannot unpack non-iterable object'

asyncio.await fails with TypeError: cannot unpack non-iterable coroutine object

numpy array , TypeError: cannot unpack non-iterable numpy.int64 object

Calling local variable causes TypeError: cannot unpack non-iterable NoneType object

Why am I getting TypeError: cannot unpack non-iterable builtin_function_or_method object?

TypeError: cannot unpack non-iterable NoneType object when running a sorting function

Error occurs running code in terminal "TypeError: cannot unpack non-iterable NoneType object"