python - How to prevent tkinter button command from executing immediately the program is run -
this question has answer here:
so i'm working on, again code in this question...
im wondering how go doing this:
from tkinter import * tkinter import messagebox mb # ... def info(text): mb.showinfo(text) # ... helpmenu.add_command(label="version", command=info("not yet realesed")) # ... what automaticly executes info().
how can prevent this?
you need use lambda function prevent info() being executed automatically:
helpmenu.add_command(label="version", command=lambda: info("not yet realesed"))
Comments
Post a Comment