this question has answer here: why button parameter “command” executed when declared? [duplicate] 2 answers i have array, holds urls. i want create button, within tk, opens url in browser. so far, i've got button create, however, when run .py file, seems function open page being hit - not prepared button. import tkinter tk import webbrowser web urls = [[1, 'http://www.google.co.uk','google'],[2, 'http://www.bbc.co.uk','bbc']]; def urlopen(target): web.open(target) window = tk.tk() window.overrideredirect(1) window.update_idletasks() url in urls: urltarget = url[0] labelurl = tk.button(window, text=url[2], height = 2, command = urlopen(url[1]), width = 10) labelurl.grid(row = url[0] + 1 , column = 1) close = tk.button(window, text = 'quit', command = window.destroy, width = 10) close.grid(row =