from tkinter import * def placeA(): x=int(input('val de xA')) y=int(input('val de yA')) xa=400+x ya=300-y can.create_rectangle(xa-1,ya-1,xa+1,ya+1) fen=Tk() b1=Button(fen,text='arret',command=fen.destroy) b1.pack() b2=Button(fen,text='place le bouton A',command=placeA) b2.pack() can=Canvas(fen,width=800,height=600,bg='ivory') can.pack(side=BOTTOM) can.create_line(0,300,800,300,arrow=LAST) fen.mainloop() xa=int(input('val de xA')) ya=int(input('val de yA')) can.create_rectangle(xa-1,ya-1,xa+1,ya+1) fen.mainloop()
Le programme ci-dessus permet de créer un point. dans un repère.
1) finir le repère : mettre un axe verticale au milieu
2) créer des boutons placer le point B, C, D
3) créer un bouton test de parallélogramme
4) créer un bouton test de rectangle
5) créer un bouton test de losange