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

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

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -