WHY WHEN I RUN CODE BUTTON JUST DO COMMAND BEFORE I CLICK IT?
kachenXDEXE

import tkinter as tk
wincal = tk.Tk()
wincal.geometry("250x300")
wincal.configure (background = 'black')
wincal.title ('THIS IS LEGIT')

bt1 = tk.Button(master=wincal,bd=9,text='LEGIT',command=print('this is legit'))
bt1.place(x=90,y=80)

wincal.mainloop()

when i run this code it print (this is legit ) but I doesnt click button

You are viewing a single comment. View All
NFadhlurrahman

@kachenXDEXE

Must it always use lambda?

No. You can use either normal function or lambda function.

Also, this is not the right way to use normal function.

Like what I said, command argument receives a function, but in your example, it receives None instead of a function.

Here is the right way to use normal function