Home > Software engineering >  Error "Your row is not an iterable (e.g. a list)" when creating window layout in PySimpleG
Error "Your row is not an iterable (e.g. a list)" when creating window layout in PySimpleG

Time:08-04

I want to code a tiny Calculator with PySimpleGUI but, when I run the Code it shows an error:

ERROR

Error Creating Window Layout

File "string"

line 18

in module

Error creating Window layout

Your row is not an iterable (e.g a list)

Instead of a list, the type found was <class 'PySimpleGUI PySimpleGUI Radio

The offensive row =

PySimpleGULPySimpleGUI Radio object at Oxb71dd28c>

This item will be stripped from your layout.

And this is my code (now):


import PySimpleGUI as pg

#Sets the theme to "Tan"

pg.theme("Tan")

#Creates the layout

layout = [[pg.Text("1. Zahl:"), pg.Input()],
    pg.Radio(" ", "action"),
    pg.Radio("-", "action"),
    pg.Radio("*", "action"),
    pg.Radio("/", "action")]
#Creates the window

window = pg.Window("LittleCalc", layout, element_justification="c", no_titlebar=False,grab_anywhere=True,size=(400,400))
window.read()

#Interact with the window

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

Knows anyone where the problem is? Thanks. Oh, and sorry for my bad English.

CodePudding user response:

each member of your layout must be a list object. in your code first layout member is a list but the other members are not.

CodePudding user response:

Hi at your layout you need to also get other items into square bracket as well like below;

layout = [[pg.Text("1. Zahl:"), pg.Input()],[pg.Radio(" ", "action")],[pg.Radio("-", "action")], [pg.Radio("*", "action")],[pg.Radio("/", "action")]]

#this part tells where is the problem

Error creating Window layout

#this should give hint about there might be wrong definition

Your row is not an iterable (e.g a list)

#here you can identify its expecting a list

Instead of a list, the type found was <class 'PySimpleGUI PySimpleGUI Radio
  • Related