# Créé par prof, le 29/06/2016 en Python 3.2 # exemple d'utilisation de tk avec Python # zone graphique où chaque pixel a une couleur en fonction de x et y # Réalisé par jean-christophe MICHEL le 29 juin 2016 from tkinter import * f=Tk() l=Label(f,text="Bonjour ! Nous somme le 29 juin 2016") l.pack() w=Canvas(width=300,height=300,bg="black") w.pack() im=PhotoImage(width=300,height=300) w.create_image((0,0),image=im,anchor='nw') for x in range(300): for y in range(300): couleur=x*y couleur_hexa=hex(couleur)[2:] while len(couleur_hexa)<6: couleur_hexa="0"+couleur_hexa couleur_hexa="#"+couleur_hexa im.put(couleur_hexa,(x,y)) f.mainloop()