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

Gene Heskett gheskett at shentel.net
Thu Dec 14 13:28:16 EST 2017


On Thursday 14 December 2017 10:00:07 Beppe wrote:

> Il giorno giovedì 14 dicembre 2017 15:18:31 UTC+1, Peter Otten ha 
scritto:
> > 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.
>
> perfect, it works too much well, even my buttons now are helvetica 14
> and red  ;(
In that event, you can label the text buttons like this:
      <button>
        <halpin>"checkbutton1"</halpin>
        <text>"CamSW"</text>
        <font>('Hack',12)</font>
      </button>
For a different font.

I'd assume <color>('green') might work, but haven't tried it since it 
cannot be changed with the halpin state. Then it would be useful to 
report status w/o having the put an led underline under it for state. 
That would save a considerable acreage in screen real estate if it were 
possible on an already busy linuxcnc gui. IMO the enforced blank space 
around text is also a huge waster of screen real estate.

You can find some tut's on doing all this in the linuxcnc 
Documentation.pdf, downloadable from linuxcnc.org, in my version 
starting on page 366. Under "pyvcp" If you know of others, plz advise.

Cheers, Gene Heskett
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page <http://geneslinuxbox.net:6309/gene>



More information about the Python-list mailing list