Button text underline option, is not working. This is what I've tried:
boldFontOpts = tkFont.Font(weight='bold')
self.boldButton = Button(self.toolbarFrame, text='B', command=self.boldfunc,
width=bWidth, height=bHeight)
self.boldButton['font'] = boldFontOpts
self.boldButton.grid(sticky=W, padx='4', row=1, column = 0)
self.underlineButton = Button(self.toolbarFrame, text='U', command=self.underlinefunc,
width=bWidth, height=bHeight)
underlineFontOpts = tkFont.Font(self.underlineButton, self.underlineButton.cget('font'))
underlineFontOpts.configure(underline=True)
self.underlineButton.configure(font=underlineFontOpts)
self.underlineButton.grid(sticky=W, padx='3', row=1, column = 1)
The code used for the underline button (which doesn't work) was taken from: Underline Text in Tkinter Label widget?
I also used the code for the bold button (which works) for the underline button, however it doesn't work when the weight='bold'
is substituted with underline=1
or underline=True
and all appropriate variable names etc. are changed (obviously).
So, how can this button text be underlined?
Additional info: - On mac - Python 3 - tinter 8.5
Edit: I added these two lines:
font = tkFont.Font(font=self.underlineButton['font'])
print(font.actual())
And in the terminal it says 'underline': 1
, yet still does not display the underline.