from GUI import Window, Button, application,\
    request_old_file, request_new_file
    
last_dir = None
last_name = None

def save_result(result):
    print "Result =", result
    global last_dir, last_name
    if result:
        last_dir = result.dir
        last_name = result.name

def do_old_file():
    print "Doing request_old_file"
    result = request_old_file("Open Musty Old File:",
        default_dir = last_dir)
    save_result(result)

def do_new_file():
    print "Doing request_new_file"
    result = request_new_file("Save Sparkling New File:",
        default_dir = last_dir, default_name = last_name)
    save_result(result)

win = Window(size = (200, 200))
but1 = Button("Old File", action = do_old_file)
but2 = Button("New File", action = do_new_file)
win.place_column([but1, but2], left = 20, top = 20)
win.show()
application().run()
