[TKinter]How to set LabelFrames font and color from option file

Peter Otten __peter__ at web.de
Thu Dec 14 09:17:56 EST 2017


Beppe wrote:

> I don't succeed in planning the value of the font and color in the
> LabelFrames using the option_db file, such as
> 
> *LabelFrame*font: Helvetica 14
> *LabelFrame*foreground: red
> 
> exist a list of the keywordses to use?

>>> import tkinter as tk
>>> root = tk.Tk()
>>> lf = tk.LabelFrame(root)
>>> lf["class"]
'Labelframe'

Do you spot the difference? The class of the LabelFrame widget is Labelframe 
with a lowercase f. Once you change your database entries to

*Labelframe*font: Helvetica 14
*Labelframe*foreground: red

everything should work as expected.




More information about the Python-list mailing list