from Tkinter import * global e def calc(): i = int(str(e.get())) x = 0 y = 0 for x in range(i): for y in range((1 + 2*i)): print y window = Tk() lbl = Label(window, text='How many iterations?') lbl.pack(side=TOP) e = Entry(name='text') e.pack(expand = YES, fill = BOTH) b = Button(window, text='Calculate', command=calc) b.pack(side=BOTTOM) window.mainloop()