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
Post a Comment