Skip to content

Anyone has idea how to insert different font size text lines to customtkinter? #2463

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

You must be logged in to vote

@Gasiro

customtkinter prohibits font option in Textbox widget as it considers run time scaling of the window. Scaling for different fonts in customtkinter Textbox is not handled, and if you are sure that user will not scale-up window at runtime time, then you can neglect its prohibition.

What happens is that, customtkinter checks the font parameter in tag_config method to raise an error. So, instead of passing font parameter directly, pass it in including as configuration dictionary (an especial argument provided by Tkinter).

Tkinter provides a parameter cnf (stands for configuration dictionary) using which programmar can pass all function arguments as dictionary object.

Sample code:

from c…

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
0 replies
Comment options

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

@dipeshSam
Comment options

@dipeshSam
Comment options

Answer selected by Gasiro
@Gasiro
Comment options

@dipeshSam
Comment options

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