470,849 Members | 1,658 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,849 developers. It's quick & easy.

tkinter, event.widget, what do i get?

when calling function hmm here, what do i get? the widget i clicked
on?
if i have a canvs on wich i have a bitmap and i click on the bitmap,
is the event.widget then the bitmap?
can i get info about the bitmap then? like color of the pixel i
clicked. if so, how?
w.bind("<Key>", key)
w.bind("<Button-1>", hmm)

def hmm(event):
return event.widget
Jun 27 '08 #1
4 3827
En Tue, 15 Apr 2008 17:45:08 -0300, <sk*******@yahoo.seescribió:
when calling function hmm here, what do i get? the widget i clicked
on?
if i have a canvs on wich i have a bitmap and i click on the bitmap,
is the event.widget then the bitmap?
can i get info about the bitmap then? like color of the pixel i
clicked. if so, how?
w.bind("<Key>", key)
w.bind("<Button-1>", hmm)

def hmm(event):
return event.widget
Why don't you try by yourself? You can use: print repr(something)

--
Gabriel Genellina

Jun 27 '08 #2
On 16 Apr, 00:24, "Gabriel Genellina" <gagsl-...@yahoo.com.arwrote:
En Tue, 15 Apr 2008 17:45:08 -0300, <skanem...@yahoo.seescribió:
when calling function hmm here, what do i get? the widget i clicked
on?
if i have a canvs on wich i have a bitmap and i click on the bitmap,
is the event.widget then the bitmap?
can i get info about the bitmap then? like color of the pixel i
clicked. if so, how?
w.bind("<Key>", key)
w.bind("<Button-1>", hmm)
def hmm(event):
return event.widget

Why don't you try by yourself? You can use: print repr(something)

--
Gabriel Genellina

i get <Tkinter.Canvas instance at 0x01B9B6E8>

thing is i get that even though i click outside the image.
and what can i do with this number anyway?
Jun 27 '08 #3
En Tue, 15 Apr 2008 20:45:24 -0300, <sk*******@yahoo.seescribió:
On 16 Apr, 00:24, "Gabriel Genellina" <gagsl-...@yahoo.com.arwrote:
>En Tue, 15 Apr 2008 17:45:08 -0300, <skanem...@yahoo.seescribió:
when calling function hmm here, what do i get? the widget i clicked
on?
if i have a canvs on wich i have a bitmap and i click on the bitmap,
is the event.widget then the bitmap?
can i get info about the bitmap then? like color of the pixel i
clicked. if so, how?
w.bind("<Key>", key)
w.bind("<Button-1>", hmm)
def hmm(event):
return event.widget

Why don't you try by yourself? You can use: print repr(something)

i get <Tkinter.Canvas instance at 0x01B9B6E8>

thing is i get that even though i click outside the image.
So you answered your first question yourself: event.widget is the canvas,
not the bitmap.
On another thread you get the other answer.
and what can i do with this number anyway?
With that specific number, nothing. The whole text says two things:

- *what* the object is: a Tkinter.Canvas instance
- *which* one: this is not the same one as <Tkinter.Canvas instance at
0x12345678>

--
Gabriel Genellina

Jun 27 '08 #4
On 16 Apr, 01:45, skanem...@yahoo.se wrote:
On 16 Apr, 00:24, "Gabriel Genellina" <gagsl-...@yahoo.com.arwrote:


En Tue, 15 Apr 2008 17:45:08 -0300, <skanem...@yahoo.seescribió:
when calling function hmm here, what do i get? the widget i clicked
on?
if i have a canvs on wich i have a bitmap and i click on the bitmap,
is the event.widget then the bitmap?
can i get info about the bitmap then? like color of the pixel i
clicked. if so, how?
w.bind("<Key>", key)
w.bind("<Button-1>", hmm)
def hmm(event):
* * return event.widget
Why don't you try by yourself? You can use: print repr(something)
--
Gabriel Genellina

i get <Tkinter.Canvas instance at 0x01B9B6E8>

thing is i get that even though i click outside the image.
and what can i do with this number anyway?- Nascondi testo tra virgolette -

- Mostra testo tra virgolette -
If your image is a canvas item (i.e. created with canvas create_image
method), then you can use
the method tag_bind to handle events specific of that item.
In that case, the callback argument is a Tkinter.Event instance.

Ciao
-----
FB
Jun 27 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Elaine Jackson | last post: by
1 post views Thread by Pekka Niiranen | last post: by
2 posts views Thread by Tonino | last post: by
1 post views Thread by Harlin Seritt | last post: by
4 posts views Thread by Christopher Subich | last post: by
2 posts views Thread by Grooooops | last post: by
2 posts views Thread by Avi Kak | last post: by
reply views Thread by WaterWalk | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.