pictures as characters in a Tk text box?

J

Jay

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.
 
S

Simon Forman

Jay said:
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
 
J

Jay

PERFECT!!! Thanks so much!


Simon said:
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
 
J

Jay

Can you do the same in wxPython?

Simon said:
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
 
C

Claudio Grondi

Jay said:
Can you do the same in wxPython?
I am a greenhorn in wxPython, so please don't bet on what I state here,
but to my current knowledge wxPython doesn't come with a widget capable
of what Tkinter text box is capable of. But wxPython comes e.g. with a
widget displaying any HTML content, so if you need only to display and
not edit things it is a perfect one to use if you need to mix text with
images and control elements.

Claudio Grondi
 

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
474,434
Messages
2,571,690
Members
48,796
Latest member
Greg L.

Latest Threads

Top