pictures as characters in a Tk text box?

Simon Forman rogue_pedro at yahoo.com
Fri Sep 1 22:05:09 EDT 2006


Jay wrote:
> This may be really obscure, but I had a dream about programming
> something like this, so don't blame me.  Is it possible to take a small
> image or icon and display it as a character in a Tk text box?  Think
> how Thunderbird displays text smilies as actual smiley icons.  Or how
> in AIM as you type a smiley, it replaces it with the picture.  Does
> anyone know how to display these specifically in a Tk text box?  Thanks.

Dreaming in Python, eh?  Maybe you should take a break.  ;-)

Sure, quoting the link below: "You can put an image or bitmap into a
text widget. It is treated as a single character whose size is the
natural size of the object."

You can also embed any Tk widget in a Tk Text widget, including
ImageTks and widgets with bitmaps.

See:
http://infohost.nmt.edu/tcc/help/pubs/tkinter/text-image.html
and
http://infohost.nmt.edu/tcc/help/pubs/tkinter/text-window.html


HTH,
~Simon




More information about the Python-list mailing list