[Solved] Python Defining Lists in Lists


Lists don’t take name-value pairs. You probably want dictionaries here instead:

definitions = {
    'title_label': {
        'text': (236, 218, 51),
        'background': (125, 142, 246)
    },
    'start_button': {
        'text': (32, 40, 145),
        'background': (236, 235, 136),
        'pressed': (44, 51, 112)
    },
    'quit_button': {
        'text': (166, 21, 13),
        'background': (48, 61, 188),
        'pressed': (31, 40, 129)
    }
}

I’m not sure where you found your syntax, but it is not valid Python. Python lists, using [...] square brackets, can only take a sequence of individual Python expressions:

some_list = ['one object', {'dictionary': 'value'}, ['another', 'list']]

See the Data structures section of the Python tutorial.

solved Python Defining Lists in Lists