gui/resource.py
def build_window(res):
    "Create a gui2py window based on the python resource"
    
    # windows specs (parameters)
    kwargs = dict(res.items())
    wintype = kwargs.pop('type')
    menubar = kwargs.pop('menubar', None)
    components = kwargs.pop('components')
    panel = kwargs.pop('panel', {})
    
    from gui import registry
    import gui
    
    winclass = registry.WINDOWS[wintype]
    win = winclass(**kwargs)

    # add an implicit panel by default (as pythoncard had)
    if False and panel is not None:
        panel['name'] = 'panel'
        p = gui.Panel(win, **panel)
    else:
        p = win
        
    if components:
        for comp in components:
            build_component(comp, parent=p)

    if menubar:
        mb = gui.MenuBar(name="menu", parent=win)
        for menu in menubar:
            build_component(menu, parent=mb)
    return win
def build_window(res):
    "Create a gui2py window based on the python resource"
    
    # windows specs (parameters)
    kwargs = dict(res.items())
    wintype = kwargs.pop('type')
    menubar = kwargs.pop('menubar', None)
    components = kwargs.pop('components')
    panel = kwargs.pop('panel', {})
    
    from gui import registry
    import gui
    
    winclass = registry.WINDOWS[wintype]
    win = winclass(**kwargs)

    # add an implicit panel by default (as pythoncard had)
    if False and panel is not None:
        panel['name'] = 'panel'
        p = gui.Panel(win, **panel)
    else:
        p = win
        
    if components:
        for comp in components:
            build_component(comp, parent=p)

    if menubar:
        mb = gui.MenuBar(name="menu", parent=win)
        for menu in menubar:
            build_component(menu, parent=mb)
    return win
Create a gui2py window based on the python resource