Bonjour!

Je dois faire tourner ce programme sous python:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
from tkinter import *
from random import randrange
 
 
def drawline():
    global x1, x2, y1, y2, coul
    can1.create_line(x1, y1, x2, y2, width=2, fill=coul)
    y2, y1= y2+10, y1-10
 
 
def changecolor():
    global coul
    pal=['purple','cyan','maroon','green','red','blue','orange','yellow']
    c=randrange(8)
    coul=pal[c]
 
 
 
x1, y1, x2, y2= 10, 190, 190, 10
coul = 'dark green'
 
fen1=Tk()
 
can1 = Canvas(fen1, bg='dark grey', height=200, width=200)
can1.pack(side=LEFT)
bou1 = Button(fen1, text='Quitter', command=fen1.quit)
bou1.pack(side=BOTTOM)
bou2 = Button(fen1, text='Tracer une ligne', command=drawline)
bou2.pack()
bou3 = Button(fen1, text='Autre couleur', command=changecolor)
bou3.pack()
 
fen1.mainloop()
fen1.destroy()
Aucun problème sous Windows 7, par contre sous MacOSX, le bouton 'Quitter' ne fonctionne pas!
Quelqu'un aurait-il une solution ?

Merci d'avance