Canvas items into widgets?

Bob Greschke bob at passcal.nmt.edu
Tue May 23 10:57:53 EDT 2006


I have a "tooltip" class that is used like

   Lab = Label(Sub, text = "Temp:")
   Lab.pack()
   Tooltip(Lab, "The temperature of the reactor core")

When the mouse pointer is placed over the "Temp:" label the associated 
message pops up in a small window near the pointer.

I want to use the same thing with a canvas item, but the "create_x" calls 
return an ID number not a widget 'handle' like Label() does.  Is there a way 
to turn these IDs into widgets?  I mean the ovals and rectangles are, 
technically, widgets already, aren't they?  I don't think the tag_bind stuff 
will quite work (but I don't fully grasp the concept, except in cases where 
you want to do something like drag the items around on the canvas) since 
each item will have a different message, like, for example, each point on a 
graph will have a tooltip that reports what the temperature of that point 
was.

The concept:

   Rec = can.create_rectangle(<small red rectangle>)
   Wig = (Then a miracle occurs)
   Tooltip(Wig, "1500C - She's gonna blow!!")


Thanks!

Bob :)





More information about the Python-list mailing list