You have to use styles to customize ttk widgets.
s = ttk.Style()
s.configure('my.TButton', font=('Helvetica', 12))
b = ttk.Button(mainframe, text='Press me', style='my.TButton',
command=foo)
Answer from Roland Smith on Stack Overflow Top answer 1 of 3
29
You have to use styles to customize ttk widgets.
s = ttk.Style()
s.configure('my.TButton', font=('Helvetica', 12))
b = ttk.Button(mainframe, text='Press me', style='my.TButton',
command=foo)
2 of 3
5
The Above answer is correct and you can change the style for all of ttk widgets(for example font) you can change the root's style whose name is '.':
s = ttk.Style()
s.configure('.', font=('Helvetica', 12))
After that, all of your ttk widgets's uses 'Helvetica' font in size '12'. The answer, derived from "https://tkdocs.com/shipman/ttk-style-layer.html"
ttkbootstrap
ttkbootstrap.readthedocs.io › en › version-0.5 › widgets › button.html
Button — ttkbootstrap documentation - Read the Docs
A ttk.Button widget displays a textual string, bitmap or image. If text is displayed, it must all be in a single font, but it can occupy multiple lines on the screen (if it contains newlines or if wrapping occurs because of the wraplength option) and one of the characters may optionally be underlined using the underline option.
Videos
03:26
Change font size without messing with Tkinter button size - YouTube
11:39
Modern Buttons In CustomTkinter - Tkinter CustomTkinter 2 - YouTube
05:57
Select Fonts With Font Dialog Box - Tkinter TTKBootstrap 26 - YouTube
07:22
How To Resize Buttons in TTKBootstrap - Tkinter TTKBootstrap 4 ...
TutorialsPoint
tutorialspoint.com › how-to-change-font-size-in-ttk-button
How to change font size in ttk.Button?
May 4, 2021 - #Import tkinter library from tkinter import * #Create an instance of tkinter frame win= Tk() #Set the Geometry win.geometry("750x250") def click_to_close(): win.destroy() #Create a Button button= Button(win, text= "Click to Close", font= ('Helvetica 20 bold italic'), command=click_to_close) ...
Python
docs.python.org › 3 › library › tkinter.ttk.html
tkinter.ttk — Tk themed widgets
The tkinter.ttk module provides ... font rendering under X11 and window transparency (requiring a composition window manager on X11). The basic idea for tkinter.ttk is to separate, to the extent possible, the code implementing a widget’s behavior from the code implementing its appearance. ... That code causes several tkinter.ttk widgets (Button, Checkbutton, ...
Narkive
comp.lang.tcl.narkive.com › 7piJqDx8 › how-to-change-the-font-and-font-size-in-ttk-button-themed-widgets
How to change the font and font size in ttk::button (themed widgets)?
[3] Is it possible to have the text in two rows inside the ttk::button? please advise. Create a style and use it with the widget. font create MyFont -family "Courier New" -size 12 ttk::style configure My.TButton {*}[ttk::style configure TButton] \ -font MyFont pack [ttk::button .b -text Styled ...
Python Examples
pythonexamples.org › python-tkinter-button-change-font
How to change Tkinter Button font style? Examples
In your Python program, import tkinter.font as font, create font.Font() object with required options and assign the Font object to font option of Button.
TkDocs
tkdocs.com › tutorial › fonts.html
TkDocs Tutorial - Fonts, Colors, Images
Tkx::font_create("AppHighlightFont", -family => "Helvetica", -size => 12, -weight => "bold"); $l = $parent->new_ttk__label(-text => "Attention!", -font => "AppHighlightFont"); $l->g_grid;
Tkinter
tkinter.com › how-to-resize-buttons-in-ttkbootstrap-tkinter-ttkbootstrap-4
How To Resize Buttons in TTKBootstrap – Tkinter TTKBootstrap 4 – TKinter.com
January 3, 2023 - from tkinter import * import ttkbootstrap as tb root = tb.Window(themename="superhero") #root = Tk() root.title("TTK Bootstrap!") root.iconbitmap('images/codemy.ico') root.geometry('500x350') # Style my_style = tb.Style() my_style.configure('success.Outline.TButton', font=("Helvetica", 18)) ...
Google Groups
groups.google.com › g › comp.lang.tcl › c › 5E9kGZ5wEHQ › m › 74JAo7-bAwAJ
How do I adjust ttk widget formatting
If so, I hope that 8.6.10 has better introspection options for the ttk widgets. ... Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message ... Dave, change the font of the ttk::labelframe: ttk::style configure TLabelframe.Label -font TitleFont Hope this helps, Harald
Google Groups
groups.google.com › g › comp.lang.tcl › c › xTZvE4rFTwk
ttk::button text size
style configure Big.TButton -font {Helvetica 60} toplevel .t pack [ttk::button .t.t -style Big.TButton -text "Tile Rocks!"]
15. The Menu widget
anzeljg.github.io › rin2 › book2 › 2405 › docs › tkinter › ttk-style-layer.html
49. Using and customizing ttk styles
There is a root style whose name is '.'. To change some feature's default appearance for every widget, you can configure this style. For example, let's suppose that you want all text to be 12-point Helvetica (unless overriden by another style or font option). This configuration would do it: s = ttk.Style() s.configure('.', font=('Helvetica', 12))
Tcl Developer Site
tcl-lang.org › man › tcl8.7 › TkCmd › ttk_button.html
ttk::button manual page - Tk Themed Widget
The class name for a ttk::button is TButton. Dynamic states: active, disabled, pressed, readonly. TButton styling options configurable with ttk::style are: -anchor anchor -background color -bordercolor color -compound compound -darkcolor color -foreground color -font font -highlightcolor color -highlightthickness amount -lightcolor color -padding padding -relief relief -shiftrelief amount
GitHub
github.com › rdbende › Sun-Valley-ttk-theme › discussions › 87
Font size in Sun Valley tkinter ttk theme · rdbende/Sun-Valley-ttk-theme · Discussion #87
s = ttk.Style() s.configure('normal.TButton', font=('Arial', 20)) findButton = ttk.Button(root1, text='Search', style='normal.TButton',command=search) findButton.place(relx=0.805,rely=0.201)
Author rdbende
Python
bugs.python.org › issue21341
Issue 21341: Configuring 'font' with ttk.Style for 'TEntry' does not change displayed font - Python tracker
April 24, 2014 - This issue tracker has been migrated to GitHub, and is currently read-only. For more information, see the GitHub FAQs in the Python's Developer Guide · This issue has been migrated to GitHub: https://github.com/python/cpython/issues/65540
TutorialsPoint
tutorialspoint.com › how-to-change-the-font-on-ttk-entry-in-tkinter
How to change the font on ttk.Entry in Tkinter?
We can specify the font property in the entry constructor. #Import tkinter library from tkinter import * from tkinter import ttk #Create an instance of tkinter frame or window win= Tk() #Set the geometry of tkinter frame win.geometry("750x250") #Create an Entry Widget entry= ttk.Entry(win,...
Tcl Wiki
wiki.tcl-lang.org › page › ttk::button
ttk::button
HaO 2013-11-22 I am in favor that the button does not take focus on cick. For me, we loose power specially for Toolbuttons. If the focus would be kept to the original place, one could easy emulate the current behaviour by: ... I suppose, this would require a TIP... HaO 2011-05-20 Use a custom style to use a custom font · ttk::style configure custom.TButton -font {size 20} pack [ttk::button .b -style custom.TButton -text Big]