def migrate_window(bg):
    "Take a pythoncard background resource and convert to a gui2py window"
    ret = {}
    for k, v in bg.items():
        if k == 'type':
            v = WIN_MAP[v]._meta.name
        elif k == 'menubar':
            menus = v['menus']
            v = [migrate_control(menu) for menu in menus]
        elif k == 'components':
            v = [migrate_control(comp) for comp in v]
        else:
            k = SPEC_MAP['Widget'].get(k, k)
        ret[k] = v
    return ret
Take a pythoncard background resource and convert to a gui2py window