473,325 Members | 2,608 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

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 3968
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Elaine Jackson | last post by:
I've got a script where a button gets pushed over and over: to cut down on the carpal tunnel syndrome I'd like to have the button respond to presses of the Enter key as well as mouse clicks; can...
1
by: Pekka Niiranen | last post by:
Hi there, after reading TkInter/thread -recipe: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/82965 I wondered if it was possible to avoid using threads for the following problem: ...
2
by: Tonino | last post by:
Hi, I have a small Tkinter app that gets data from a socket connection to a "server". The app has a Text() widget to display the info that it gets from the socket connection. I have the...
1
by: Harlin Seritt | last post by:
I am working on making something called a PopMsg widget which is actually identical to a Balloon widget from Pmw. Here is the code: ---code--- from Tkinter import * import time class PopMsg:...
4
by: Christopher Subich | last post by:
I'm building an application involving both twisted and Tkinter. Since twisted co-opts <widget>.mainloop() in its reactor.run(), and since it behaves very badly if the application quits without...
2
by: Grooooops | last post by:
I've been hacking around this for a few days and have gotten close to what I want... but not quite... The TKinter Docs provide this example: # configure text tag text.tag_config("a",...
2
by: Avi Kak | last post by:
Does Tkinter provide a function that returns all the event descriptors for a given widget class? I am looking for something similar to what you get in Perl/Tk when you call bind() with a single...
0
by: WaterWalk | last post by:
Hello. When I tried to make Tkinter canvas widget respond to MouseWheel event on Windows XP, I failed. The canvas just doesn't receive MouseWheel event. I used bind_all to find out which widget...
4
by: Mudcat | last post by:
I've tried quite a few things to get this correct but have hit a couple of sticking points that I can't figure out. I need to ge the Text box to function like the 'wraplength' option in a Label. ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.