Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ttk::button text size

233 views
Skip to first unread message

Michael

unread,
May 13, 2007, 8:02:25 PM5/13/07
to
Hi,

Is it possible to make the size of the text in the ttk:button bigger?
I've tried setting the global font size but only makes the label texts
size bigger.

option add *font "Helvetica 20"

M.

Mats

unread,
May 14, 2007, 3:00:43 AM5/14/07
to

style configure Big.TButton -font {Helvetica 60}
toplevel .t
pack [ttk::button .t.t -style Big.TButton -text "Tile Rocks!"]

/Mats

Michael

unread,
May 14, 2007, 4:43:00 AM5/14/07
to

Thanks Mats, is working nicely.

style configure Big.TButton -font {Helvetica 20} -background red -
foreground white

proc makeKeyboard { keySet } {
set keyboard [ttk::frame $::BASE.keyboard]
for {set row 0} {$row < 4} {incr row} {
grid rowconfigure $keyboard $row -weight 1 -uniform buttons -
minsize 50
for {set col 0} {$col < 8} {incr col} {
if {!$row} {
grid columnconfigure $keyboard $col -weight 1 -uniform
buttons -minsize 50
}
set key [lindex [lindex $keySet $row] $col]
grid [ttk::button $keyboard.b$row$col -takefocus 0 -style
Big.TButton -text $key -command [list keyAction $key]] \
-row $row -column $col -sticky snew
}
}

$::pw add $keyboard
}

I've set the text and background of the buttons in my program. How can
I set the button color? I thought it was using the -background option
but this sets the background of the button itself.

M.

Joe English

unread,
May 14, 2007, 12:02:47 PM5/14/07
to

Most Tile widgets (ttk::button included) do not have
a "-font" option, so option database settings have no
effect.

You can change the default font size for all widgets by
modifying the named font TkDefaultFont:

font configure TkDefaultFont -size 20

or for button widgets only by changing the style database:

ttk::style configure TButton -font "Helvetica 20"


--Joe English

0 new messages