gui/component.py
def get(obj_name, init=False):
    "Find an object already created"
    wx_parent = None
    # check if new_parent is given as string (useful for designer!)
    if isinstance(obj_name, basestring):
        # find the object reference in the already created gui2py objects
        # TODO: only useful for designer, get a better way
        obj_parent = COMPONENTS.get(obj_name)
        if not obj_parent:
            # try to find window (it can be a plain wx frame/control)
            wx_parent = wx.FindWindowByName(obj_name)
            if wx_parent:
                # store gui object (if any)
                obj_parent = getattr(wx_parent, "obj") 
            else:
                # fallback using just object name (backward compatibility)
                for obj in COMPONENTS.values():
                    if obj.name==obj_name:
                        obj_parent = obj 
    else:
        obj_parent = obj_name     # use the provided parent (as is)
    return obj_parent or wx_parent
def get(obj_name, init=False):
    "Find an object already created"
    wx_parent = None
    # check if new_parent is given as string (useful for designer!)
    if isinstance(obj_name, basestring):
        # find the object reference in the already created gui2py objects
        # TODO: only useful for designer, get a better way
        obj_parent = COMPONENTS.get(obj_name)
        if not obj_parent:
            # try to find window (it can be a plain wx frame/control)
            wx_parent = wx.FindWindowByName(obj_name)
            if wx_parent:
                # store gui object (if any)
                obj_parent = getattr(wx_parent, "obj") 
            else:
                # fallback using just object name (backward compatibility)
                for obj in COMPONENTS.values():
                    if obj.name==obj_name:
                        obj_parent = obj 
    else:
        obj_parent = obj_name     # use the provided parent (as is)
    return obj_parent or wx_parent
def get ( obj_name , init = False ) : wx_parent = None # check if new_parent is given as string (useful for designer!)
 if isinstance ( obj_name , basestring ) : # find the object reference in the already created gui2py objects
 # TODO: only useful for designer, get a better way
 obj_parent = COMPONENTS . get ( obj_name ) if not obj_parent : # try to find window (it can be a plain wx frame/control)
 wx_parent = wx . FindWindowByName ( obj_name ) if wx_parent : # store gui object (if any)
 obj_parent = getattr ( wx_parent , "obj" ) else : # fallback using just object name (backward compatibility)
 for obj in COMPONENTS . values ( ) : if obj . name == obj_name : obj_parent = obj else : obj_parent = obj_name # use the provided parent (as is)
 return obj_parent or wx_parent
Find an object already created
Find an object already created