from GUI import Window, TextField, Button, application

def show_text(*fields):
    for i in range(len(fields)):
        print "Field %d:" % i, repr(fields[i].text), repr(fields[i].selection)

def make_window(i):
    win = Window(size = (240, 160), title = "Text fields %d" % (i+1))
    win.y += i * 220
    tf1 = TextField(position = (20, 20), width = 200)
    tf2 = TextField(position = (20, 60), width = 200, multiline = 1, lines = 2)
    but = Button("Show", position = (20, 120), action = (show_text, tf1, tf2))
    win.add(tf1)
    win.add(tf2)
    win.add(but)
    win.show()

for i in range(2):
    make_window(i)

application().run()
