def save_pos(win, cfg):
    """Save a window position to the registry"""
    (xpos, ypos) = win.GetPositionTuple()
    (width, height) = win.GetSizeTuple()
    cfg.WriteInt('xpos', xpos)
    cfg.WriteInt('ypos', ypos)
    cfg.WriteInt('width', width)
    cfg.WriteInt('height', height)
Save a window position to the registry
recipes/Python/409012_A_Simple_ZODB_viewer_in_wxPython/recipe-409012.py