I have searched without success for a way to format the text in a Tkinter OptionMenu List. Specifically, I want to use some subscripted letters. Something like:

from Tkinter import *

root = Tk()
types =
type = StringVar()
typewidget = OptionMenu(root, type, *types)
typewidget.grid()

I need specifically the 'd' and 'oc' subscripted. I am aware that some characters are available in unicode (for example subscript 'o') but 'c' and 'd' are not.

Recommended Answers

All 3 Replies

Maybe you would need to switch over to pySide (aka pyQT) or wx toolkits. They have more complicated formatting available.

Here is example of superscript used for printing polynomials in main text box using FancyText of wx:
http://www.daniweb.com/software-development/python/code/322922

Maybe you would need to switch over to pySide (aka pyQT) or wx toolkits.

So there is no way to do this? Well I'm not going to re-write 2000 lines with a new toolkit at this point for one cosmetic issue. But it is frustrating that there are no unicode characters for some sub/superscripted letters.

AFAIK the Tkinter text widget is the only widget that will do sub/super-scripts. You would have to use a gif of the text or some other nasty work around to do it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.