Ejemplo 1: función de un botón en tkinter
from tkinter import *
#Creating a win
win = Tk()
#Giving a Function To The Button
def btn1():
print("I Don't Know Your Name")
#Creating The Button
button1 = Button(win, text="Click Me To Print SomeThing", command=btn1)
#put on screen
button1.pack()
win.mainloop()
#NB:This programme Will Print Something In The Terminal
#Check My Profile To See How We Print On The Screen Or Type In Google "Tkinter Label"
Ejemplo 2: botón de python tkinter
from tkinter import *
wow = Tk()
def ree(hi):
print(hi)
w = Button ( master=wow, command=ree('hi'), text="hi" )
Output:
Tkinter:
______
[ hi ] <--- Button
------
Shell:
hi <--- on button pressed
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)