import elementary

def destroy(obj, event, *args, **kargs):
    print "DEBUG: window destroy callback called!"
    elementary.exit()
    
def button0_clicked(obj, event, *args, **kargs):
    print "DEBUG: button0 clicked!"

if __name__ == "__main__":
    #  C{function(object, event_info, *args, **kargs)}
    elementary.init()
    win = elementary.Window("test", elementary.ELM_WIN_BASIC)
    win.destroy = destroy
    
    bg = elementary.Background(win)
    win.resize_object_add(bg)
    bg.size_hint_weight_set(1.0, 1.0)
    bg.show()

    box0 = elementary.Box(win)
    win.resize_object_add(box0)
    box0.size_hint_weight_set(1.0, 1.0)
    
    button0 = elementary.Button(win)
    button0.label_set("button0")
    button0.clicked = button0_clicked
    box0.pack_start(button0)
    button0.show()

    button1 = elementary.Button(win)
    button1.label_set("button1")
    button1.size_hint_weight_set(0.5, 0.5)
    box0.pack_start(button1)
    button1.show()
    
    toggle0 = elementary.Toggle(win)
    toggle0.states_labels_set("An","Aus")
    box0.pack_start(toggle0)
    toggle0.show()

    entry0 = elementary.Entry(win)
    box0.pack_start(entry0)
    entry0.show()

    box0.show()
    win.resize(320,520)
    win.show()
    elementary.run()
    elementary.shutdown()

