[Tkinter-discuss] newbie request for help
John W. Shipman
john at nmt.edu
Tue Jun 7 19:23:37 CEST 2011
+--
| 1) open a text file
| 2) display the text file, with links in the form {{image.jpg}} replaced by
| the image, and [[linkname|linkfile.txt]] replaced by linkname
| 3) when clicking on linkname, save the current text file and open in its
| place the file linkfile.txt
+--
Tkinter can do all that. A few suggestions:
- You will want to use a Text widget for your main display.
Conceptually, this widget displays a sequence of lines of text.
An image is treated as a single character: it is displayed on a
line between the text that comes before it and the text that
comes after it.
- Use tags to change the appearance of links so the reader will
know they are clickable. You can apply named tags to any
number of regions in your Text widget. Each tag is associated
with options such as text color, background color, and font.
Here's a Tkinter reference that may help you:
http://www.nmt.edu/tcc/help/pubs/tkinter
Read closely the sections of "The Text Widget", especially
the subsections "Text widget tags" and "Methods on Text
widgets". In the latter subsection, note these methods:
.tag_add: For applying a specific tag to a region of text.
.tag_bind: Make regions tagged with a certain tag respond to
events such as mouse clicks.
.tag_config: Change the appearance of all regions tagged
with a certain tag.
Best regards,
John Shipman (john at nmt.edu), Applications Specialist, NM Tech Computer Center,
Speare 119, Socorro, NM 87801, (575) 835-5735, http://www.nmt.edu/~john
``Let's go outside and commiserate with nature.'' --Dave Farber
More information about the Tkinter-discuss
mailing list