How can I print to console after button press?(Python 3.5) -


this question has answer here:

when run code "15" printed console. how can print after press button?

from tkinter import * def mult(n):     print (n*3)  top = tk() b1 = button(top, text = "enter number", command = mult(5)) b1.pack() top.mainloop() 

function arguments evaluated before calling function.

make callable:

from tkinter import * def mult(n):     print (n*3)  top = tk() b1 = button(top, text = "enter number", command = lambda: mult(5)) b1.pack() top.mainloop() 

Comments

Popular posts from this blog

many to many - Django Rest Framework ManyToMany filter multiple values -

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

Java Entity Manager - JSON reader was expecting a value but found 'db' -