Giter Club home page Giter Club logo

Comments (4)

LorenzSLH avatar LorenzSLH commented on May 27, 2024 1

experienced the same problem. My workaround was to use tkinters label module. Create some instances for fonts you wanna use in your program and then assign it to the labels, buttons, etc.

import tkinter.font as font 
fontTitel = font.Font(family="Helvetica", size=10, weight="bold")

With that you have still a global control of all used fonts and dont have to change it in every widget.

I hope there will be a option in Styles later on to change the font with it.

best regrads :)

from ttkbootstrap.

israel-dryer avatar israel-dryer commented on May 27, 2024 1

Thanks for the input. Agreed this is a good approach.

You can also use the named fonts as well. There are several such as "TkDefaultFont" and "TkTextFont", etc.... These are applied automatically if no font is specifically configured. This is the approach I plan to take eventually, releasing control of the font to the default system to ensure I get the best cross platform look & feel. For now, you'd have to set the font to a named font because I'm currently overriding it, but eventually it will just default (as is normal) to the default font.

To update a default font:

f = font.nametofont("TkDefaultFont")
f.configure(family="Helvetica", size=10, weight="bold")

from ttkbootstrap.

israel-dryer avatar israel-dryer commented on May 27, 2024

Try setting the font directly in the label.

from tkinter import *
from tkinter import ttk
from ttkbootstrap import Style

root = Tk()
style = Style(theme='journal')


main_notebook = ttk.Notebook(root)
main_notebook.pack(pady=15,padx=15)

master = ttk.Frame(main_notebook)
master.configure(width=300)

cal_Label = ttk.Label(
    master, 
    text="Choose the starting date.", 
    style='primary.TLabel',
    font=('Arial', 25, 'bold')
    )
cal_Label.grid(row = 0, column = 0,sticky=W)

main_notebook.add(master, text='Test')
root.mainloop()

Here's a working example:
https://replit.com/@IsraelDryer/WhoppingDodgerblueStructures#main.py

from ttkbootstrap.

mdscientist avatar mdscientist commented on May 27, 2024

That works, thank you!

For some reason the global style setting ,'style.configure('.', font=('Arial', 18)) with ttkbootstrap, doesn't affect the ttk.Labels like ttk.Style() does.

from ttkbootstrap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.