Is there a way to have fonts use styles ? #505
Replies: 3 comments
-
Currently there is no way to set font weight in guizero. I'm surprised it's not been requested as a feature before tbh. I think the change would be to add a font_weight property to the TextMixin which set the appropriate cascade properties. |
Beta Was this translation helpful? Give feedback.
-
Yeah seems right, I ended up patching the methods "set_text_size" and "set_font" from TextMixin with something along the lines of:
Did this using my own functions just after Guizero initialization in my program:
Since the project is not new and I seem to be the only one referring to this, I am guessing this would not be prioritized ? I can create an official issue / PR if required. In any case, I got it working for what I needed to do. Thanks. |
Beta Was this translation helpful? Give feedback.
-
Happy to accept a PR. In addition to modifying the TextMixin, the Container
class would been modifying to cascade the values to child widgets i.e.
https://github.com/lawsie/guizero/blob/master/guizero/base.py#L213
…On Fri, 24 May 2024, 15:25 Blindstars, ***@***.***> wrote:
Yeah seems right,
I ended up patching the methods "set_text_size" and "set_font" from
TextMixin with something along the lines of:
widget._set_tk_config("font", (f["family"], size, f["weight"]))
Did this using my own functions just after Guizero initialization in my
program:
TextMixin.set_font = set_font
TextMixin.set_text_size = set_text_size`
Since the project is not new and I seem to be the only one referring to
this, I am guessing this would not be prioritized ? I can create an
official issue / PR if required.
In any case, I got it working for what I needed to do.
Thanks.
—
Reply to this email directly, view it on GitHub
<#505 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AARYXHJKOSB7N52CDMX233LZD5EVLAVCNFSM6AAAAABICT3IOGVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4TKNBYGI4TS>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Hi,
I have been googling this for a while and found nothing. I am looking to make some Texts in Bold or Italic, etc.
Looking at the function "set_text_size" from "TextMixin" class, I see that it forces the use of "family" as the style.
Do we have options to set the style other than overriding TK directly ? I want to set all "default" text to bold for instance, would find it inefficient to override every widget...
Thanks !
Beta Was this translation helpful? Give feedback.
All reactions