What is this widget? -- again

M

Muddy Coder

Hi Folks,

Sorry for the unclear question in last post. Well, I am using Tkinter
to do GUI, and I just don't know what kind of widget can let me do
annotation on an image being displayed. An example is the Paint of
Windows: a dotted line box appearing on a image to hold a typed in
text. I just can't figure out what widget in Tkinter is equivalent to
that dotted line box. Please help, thanks again!


Cosmo
 
D

Dennis Lee Bieber

Bad form to start a new thread rather than continuing in the one you
started.

Hi Folks,

Sorry for the unclear question in last post. Well, I am using Tkinter
to do GUI, and I just don't know what kind of widget can let me do
annotation on an image being displayed. An example is the Paint of
Windows: a dotted line box appearing on a image to hold a typed in
text. I just can't figure out what widget in Tkinter is equivalent to
that dotted line box. Please help, thanks again!

As I implied in my previous response, especially since you mention
the basic Paint program in Windows...

The odds are very good that it is NOT A WIDGET. It is all LOW-LEVEL
code intercepting keystrokes and mouse movements, and actually drawing
the text onto the "canvas" in real-time (or, if you insist on a widget
-- the widget is the canvas itself!). In order to allow for deletes and
resizing, the background image has to be kept as a separate buffer that
can be blitted into the visible canvas when needed.
 
R

Rick Johnson

Hi Folks,

Sorry for the unclear question in last post. Well, I am using Tkinter
to do GUI, and I just don't know what kind of widget can let me do
annotation on an image being displayed. An example is the Paint of
Windows: a dotted line box appearing on a image to hold a typed in
text. I just can't figure out what widget in Tkinter is equivalent to
that dotted line box. Please help, thanks again!

Cosmo

No such widget exists in Tkinter. As Dennis said the code must be
written. I can assure you that this functionality can be created with
Tkinter (because i've done it myself) however it requires an in-depth
knowledge of Tkinter -- which apparently you don't have since you are
asking the question.

Waring: NEVER USE ANY MICROSOFT INTERFACE AS INSPIRATION!!!

Whist you ponder the intricacies professional of image annotation, i
suggest you follow my advice in your OTHER post (of the same title)
and use the "canvas.create_text" method to draw text on top of images
THEN you need to learn how to move "canvas items" around the canvas
using the mouse THEN you need to intercept right clicks on the text
item and show a dialog with an entry widget stuffed inside so the user
can edit the text THEN update the canvas text from user input. When
solving a problem you need to follow a linear path. The first step in
this path is to draw text on a canvas.

1. Draw text to a canvas.
2. Intercept right click events on a "canvas text".
3. Build a custom dialog using tkSimpleDialog (or use a floating
"canvas window") to display a Tkinter Entry widget so the user can
edit the current value of the "canvas text".
4. Fetch the value of Tkinter "canvas text"
5. Load the value into the entry widget.
6. Update the value of the canvas text item based on user input
returned from the dialog.

Extra Credit:
* capture mouse drag events and allow user manipulation of "canvas
text" x-y position.

http://infohost.nmt.edu/tcc/help/pubs/tkinter/
http://effbot.org/tkinterbook/

....may the source be with you.
 
8

88888 Dihedral

No such widget exists in Tkinter. As Dennis said the code must be
written. I can assure you that this functionality can be created with
Tkinter (because i've done it myself) however it requires an in-depth
knowledge of Tkinter -- which apparently you don't have since you are
asking the question.

Waring: NEVER USE ANY MICROSOFT INTERFACE AS INSPIRATION!!!

Whist you ponder the intricacies professional of image annotation, i
suggest you follow my advice in your OTHER post (of the same title)
and use the "canvas.create_text" method to draw text on top of images
THEN you need to learn how to move "canvas items" around the canvas
using the mouse THEN you need to intercept right clicks on the text
item and show a dialog with an entry widget stuffed inside so the user
can edit the text THEN update the canvas text from user input. When
solving a problem you need to follow a linear path. The first step in
this path is to draw text on a canvas.

1. Draw text to a canvas.
2. Intercept right click events on a "canvas text".
3. Build a custom dialog using tkSimpleDialog (or use a floating
"canvas window") to display a Tkinter Entry widget so the user can
edit the current value of the "canvas text".
4. Fetch the value of Tkinter "canvas text"
5. Load the value into the entry widget.
6. Update the value of the canvas text item based on user input
returned from the dialog.

Extra Credit:
* capture mouse drag events and allow user manipulation of "canvas
text" x-y position.

http://infohost.nmt.edu/tcc/help/pubs/tkinter/
http://effbot.org/tkinterbook/

...may the source be with you.

Check BOA and wxpython and work out the examples.

It is kind of boring and not too easy to be accustomed to use.

A simpler set of the toolkit pygame and pyimg to explore is another way to
advance.

Study the source of pyimg is very helpful.
 

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

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top