1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
|
def Graphe ():
Graphe = Toplevel(fenetre)
self= Canvas(Graphe, width=800, height=800)
larg,haut= 800,800
# tracé un point
for i in range(1,5):
a=float(input("donner l'absice du point"))
o=float(input("donner l'ordonné du point"))
x = 400+(a*40)
y = 400-(o*40)
self.create_oval(x-3,y-3,x+3,y+3,fill='black')
# tracé de la grille
las = (haut)/20. # intervalles de l'échelle
for s in range(1,20):
sty = s*las
self.create_line(larg/2+haut, sty, larg/2-haut, sty,fill='grey' )
pas = larg/20.
for t in range(1, 20):
stx = t*pas
self.create_line(stx, haut/2-larg, stx, haut/2+larg, fill='grey')
# tracé des axes de référence :
self.create_line(0, haut/2, larg, haut/2, arrow=LAST,fill='black') # axe X
self.create_line(larg/2, haut, larg/2, 0, arrow=LAST) # axe Y
# tracé des graduations
las = (haut)/20. # intervalles de l'échelle
for s in range(1,20):
sty = s*las
self.create_line(larg/2+4, sty, larg/2-4, sty)
pas = larg/20.
for t in range(1, 20):
stx = t*pas
self.create_line(stx, haut/2+4, stx, haut/2-4)
# tracé un repère numérique
# tracé le repère de l'axe des absices
self.create_text(397,410, text="0", anchor=CENTER)
self.create_text(440,410, text="1", anchor=CENTER)
self.create_text(480,410, text="2", anchor=CENTER)
self.create_text(520,410, text="3", anchor=CENTER)
self.create_text(560,410, text="4", anchor=CENTER)
self.create_text(600,410, text="5", anchor=CENTER)
self.create_text(640,410, text="6", anchor=CENTER)
self.create_text(680,410, text="7", anchor=CENTER)
self.create_text(720,410, text="8", anchor=CENTER)
self.create_text(760,410, text="9", anchor=CENTER)
self.create_text(357,410, text="-1", anchor=CENTER)
self.create_text(317,410, text="-2", anchor=CENTER)
self.create_text(277,410, text="-3", anchor=CENTER)
self.create_text(237,410, text="-4", anchor=CENTER)
self.create_text(197,410, text="-5", anchor=CENTER)
self.create_text(157,410, text="-6", anchor=CENTER)
self.create_text(117,410, text="-7", anchor=CENTER)
self.create_text(77,410, text="-8", anchor=CENTER)
self.create_text(37,410, text="-9", anchor=CENTER)
# tracé le repère de l'axe des ordonnés
self.create_text(390,360, text="1", anchor=CENTER)
self.create_text(390,320, text="2", anchor=CENTER)
self.create_text(390,280, text="3", anchor=CENTER)
self.create_text(390,240, text="4", anchor=CENTER)
self.create_text(390,200, text="5", anchor=CENTER)
self.create_text(390,160, text="6", anchor=CENTER)
self.create_text(390,120, text="7", anchor=CENTER)
self.create_text(390,80, text="8", anchor=CENTER)
self.create_text(390,40, text="9", anchor=CENTER)
self.create_text(390,440, text="-1", anchor=CENTER)
self.create_text(390,480, text="-2", anchor=CENTER)
self.create_text(390,520, text="-3", anchor=CENTER)
self.create_text(390,560, text="-4", anchor=CENTER)
self.create_text(390,600, text="-5", anchor=CENTER)
self.create_text(390,640, text="-6", anchor=CENTER)
self.create_text(390,680, text="-7", anchor=CENTER)
self.create_text(390,720, text="-8", anchor=CENTER)
self.create_text(390,760, text="-9", anchor=CENTER)
butQuit=Button(Graphe,relief=GROOVE, text="Fermer", fg="red",command=Graphe.destroy)
self.pack()
butQuit.pack() |
Partager