get TkCanvas from an item?

  • Thread starter R. Mark Volkmann
  • Start date
R

R. Mark Volkmann

If I have a Tk item like a TkcRectangle that has been created on a TkCanvas,
is there a way to ask the TkcRectangle for the TkCanvas that it is on? For
example, can I do something similar to this?

root = TkRoot.new {title 'Diagram'}
canvas = TkCanvas.new(root)
item = TkcRectangle.new(canvas, x, y, x + width, y + height)

the_canvas = item.canvas # not a real method

or

the_canvas = item.parent # not a real method
 
H

Hidetoshi NAGAI

Hi,

From: "R. Mark Volkmann" <[email protected]>
Subject: get TkCanvas from an item?
Date: Sun, 5 Dec 2004 07:13:30 +0900
Message-ID: said:
If I have a Tk item like a TkcRectangle that has been created on a TkCanvas,
is there a way to ask the TkcRectangle for the TkCanvas that it is on? For
example, can I do something similar to this?

If you want that, please add the following to your script.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top