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
|
#! /usr/bin/env python
# -*- coding:Utf8 -*-
from Tkinter import * # module Tkinter pour Python 2
from random import randrange
class Bac_a_sable(Canvas):
"Canevas modifié pour prendre en compte quelques actions de la souris"
def __init__(self, boss, width=1366, height=660, bg="white"):
# invocation du constructeur de la classe parente :
Canvas.__init__(self, boss, width=width, height=height, bg=bg)
if __name__ == '__main__': # ---- Programme de test ----
couleurs =('red','orange','yellow','green','cyan','blue','violet','purple')
fen =Tk()
# mise en place du canevas - dessin de 15 ellipses colorés :
bac =Bac_a_sable(fen, width =1366, height =660, bg ='ivory')
bac.pack(padx =5, pady =3)
# Insérer turtle
#
#
# bouton de sortie :
b_fin = Button(fen, text ='Terminer', bg ='royal blue', fg ='white',
font =('Helvetica', 10, 'bold'), command =fen.quit)
b_fin.pack(pady =2)
fen.mainloop() |