Skip to content

Anyone has idea about how to change certain CTK widget fonts? #2466

Answered by dipeshSam
Gasiro asked this question in Q&A
Discussion options

You must be logged in to vote

@Gasiro

There are two way to do so:

  1. Set global font (Recommended)
  2. Change font of Tabview's segmented button

We can change font of all the widgets just using one statement of ThemeManager. Otherwise, we can iterate through buttons, and can change their fonts individually.

Sample code for way first:

from customtkinter import (
    CTk, 
    CTkTabview,
    CTkEntry,
    CTkFont
)

from customtkinter import ThemeManager

if __name__ == "__main__":
    app = CTk()
    
    # This will simply change font of ALL THE WIDGETS.
    ThemeManager.theme["CTkFont"] = CTkFont("Impact", 20)
    
    tabs = CTkTabview(app)
    tabs.add("Tab1")
    tabs.add("Tab2")
    tabs.add("Tab3")
    tabs.pack()
 …

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Gasiro
Comment options

@dipeshSam
Comment options

Answer selected by Gasiro
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants