je voudrais faire apparaitre un petit cercle rouge r=2 à l'endroit du click et oh surprise il n'apparait pas ,il me semble pourtant bien avoir relié cercle avec le click <Button-1>
Voila mon code :
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
 
#! /usr/bin/env python
# -*- coding: Latin-1 -*-
 
# Détection et positionnement d'un clic de souris dans une fenêtre :
 
from Tkinter import * 
def  pointeur(event):
    chaine.configure(text = "clic détecté en x =" +str(event.x)+\
    ",y="+str(event.y))
 
 
 
def cercle(x, y, r, coul):
    can.create_oval(x-r, y-r, x+r, y+r, fill=coul)
 
 
 
 
fen1 =Tk()
can =Canvas(fen1,width = 200,height = 150,bg = 'ivory')
 
can.bind("<Button-1>",pointeur)
can.pack()
r=2
cercle(x,y,'red')
 
can.bind("<Button-1>",cercle)
can.pack()
chaine = Label(fen1)
chaine.pack()
 
fen1.mainloop()

Merci pour votre aide