Interface graphique Tkinter

https://python.doctor/page-tkinter-interface-graphique-python-tutoriel

https://python.developpez.com/cours/TutoSwinnen/?page=Chapitre8

===== Hello world =====

from tkinter import *
fenetre = Tk()
texte1 = Label(fenetre, text='Hello world', fg='red')
texte1.pack()
bouton1 = Button(fenetre, text='Quitter', command = fenetre.destroy)
bouton1.pack()
fenetre.mainloop()

Calculatrice

from tkinter import *
from math import *
# définition de l'action à effectuer si l'utilisateur actionne
# la touche "enter" alors qu'il édite le champ d'entrée :
x = 10
def evaluer(event):
chaine.configure(text = "Résultat = " + str(eval(entree.get())))
# ----- Programme principal : -----
fenetre = Tk()
entree = Entry(fenetre)
entree.bind("<Return>", evaluer)
chaine = Label(fenetre)
entree.pack()
chaine.pack()
fenetre.mainloop()

data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAABICAYAAAAwAEE4AAAEvklEQVR4nO2av2vzRhjHbynt+HbU9O4emhdCRKukZHk9lZKUt8FpXgJHXyJooWBIp+zlVkHnQKYstwb9C8lgNGQrl78gEBAEQpbk28G2rN+WrbMs5Z4PPGCkwzrd5+55TrKZZVloU/R6vcrnytq+tRgOh1qDWZYFwixIvKGQeEMh8YZC4g2FxBuKVvFXV1f45dMn/DU81fJ9xOrQIv7h4QEnJydwdr7H+fUjdnd39fSOWBlaxHPOcX79iPPrR/SFwv7+vqbuEauitvi49O+O/kVfKBwcHOD+/l5jN6vDGKsUbYMxhtFoVHh+NBpp7Xct8U9PT9jZ+QHn1494/+MX9IXCx9/+xuHhobYOLkqVwWmj+NFohK++/iZXftm5Zakl/vj4OFrtjDH0hcLm5ubaVjvQXfFAvuBVSAdqiL+7u8OHDxsJ6X2hMBgMtHZwUbosHkiKXpV0oIb409PTzGp39v/E3t6e9k4uQtfFAzP5q5IOzBE/b4MUl/7xn/+wtbWFl5eXlXS0KiS+Gkuv+MFgkBC/9dMfODs7W0EXF6Pr4luf6o+OjgAgEr+9vY3X11fd/VuYLovvxObOcRx8/v0LGGN49+5b3Nzca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