On Thursday, December 15, 2011 11:53:55 PM UTC+8, Rick Johnson wrote: > On Dec 14, 8:17 pm, Muddy Coder <cosmo_...@yahoo.com> wrote: > > 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.
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. -- http://mail.python.org/mailman/listinfo/python-list