V Mon, 31 Jan 2011 13:22:46 +0100
Georges Arsouze <[email protected]> napsáno:
hi,
just try
zoneDessin = Canvas(fenetre, width =300, height =300, bg ='blue')
zoneDessin.config(highlightthickness=0)
> With python3.1 I write this program
> When I click buton1 there are missing pixels at the end of horizontal
> and vertical lines
> why
>
> from tkinter import *
>
> def tracerCercle(x,y,r,c):
> "Tracé dans zoneDessin d'un cercle de centre (x,y) de rayon r et
> de couleur c"
> zoneDessin.create_oval(x-r,y-r,x+r,y+r,outline=c)
>
> def tracerLigne(x1,y1,x2,y2,c):
> "Tracé dans zoneDessin d'une ligne de couleur c dont les
> extrimités sont (x1,y1) et (x2,y2)"
> zoneDessin.create_line(x1,y1,x2,y2,fill=c,width=1)
>
>
> def tracerFigure1():
> zoneDessin.delete(ALL)
> # Dessin d'une cible
> # Tracé des axes
> tracerLigne(150,0,150,300,'red')
> tracerLigne(0,150,300,150,'red')
> # Tracé de cercles concentriques
> rayon=100
> i=1
> while(i<10):
> tracerCercle(150,150,rayon,'red')
> rayon=rayon-10
> i=i+1
>
> def tracerFigure2():
> print('eee')
>
>
>
>
> # Programme principal
> fenetre = Tk()
> zoneDessin = Canvas(fenetre, width =300, height =300, bg ='blue')
> # zoneDessin est un carré (300,300) ayant pour système de coordonnées
> # origine du repère le coin supérieur gauche, abscisses et ordonnées
> exclusivement positives
> zoneDessin.pack(side =TOP)
> bouton1 = Button(fenetre, text ='Dessin 1', command =tracerFigure1)
> bouton1.pack(side =LEFT, padx =3, pady =3)
> bouton2 = Button(fenetre, text ='Dessin 2', command =tracerFigure2)
> bouton2.pack(side =RIGHT, padx =3, pady =3)
> fenetre.mainloop()
>
> Thank you for your help
_______________________________________________
Tkinter-discuss mailing list
[email protected]
http://mail.python.org/mailman/listinfo/tkinter-discuss