Tkinter si usa per create finestre e grafica con Python

sintassi bottone
import tkinter

oggetto_bottone = tkinter.Button(oggetto_finestra associata,text="stringa testo bottone") creo il bottone con testo
oggetto_bottone.pack() impacchetto il bottone nella finestra

creo il bottone con testo + impacchetto direttamente
oggetto_bottone = tkinter.Button(oggetto_finestra associata,text="stringa testo bottone").pack()

settaggio



esempio: finestra con bottone che esegue un comando
import tkinter

def eseguicomando(): funzione da eseguire con il bottone

print("Buongiorno")



finestra = tkinter.Tk()
finestra.title("Esempio di finestra")
finestra.geometry("700x300")

pulsante = tkinter.Button(finestra,text="Bottone TEST",command=eseguicomando)
pulsante.pack()