Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "rehint()" on the background of the widget after changing font size [Core] [Cocoa] #176

Dayof opened this issue Jun 7, 2017 · 6 comments


Copy link

@Dayof Dayof commented Jun 7, 2017

To reproduce this error I made this code .

The following image shows the a normal behavior of a Label, with the Font size modified, inside of a Box:


And in the next image shows the a bad behavior of a Label, with the Font size modified, inside of a Box and this Box is inside of a SplitContainer:


After applying a test_status.rehint() the size of the Label adjust as should it be:


This method (rehint()) should be activated on Toga background after change a Labels Font, without forcing the user worry about this.

Copy link

@barryjohnthompson barryjohnthompson commented Feb 12, 2018

Hi! I'd be interested in taking a look at this issue, if it still needs to be done?

Copy link

@Donyme Donyme commented Mar 8, 2018

AttributeError: 'Label' object has no attribute 'set_font'
Am receiving this error upon running the code

Copy link

@mav-erick mav-erick commented Jan 21, 2019

@Dayof @freakboy3742 I am facing the same problem as @Donyme. set_font is implemented in
But not in
As far as I can work out this is where the import is from and hence it is throwing an AttributeError. Is this an implementation that this project has moved on from, or is it missing? As I am new to this codebase I am not able to work it out. Could anyone point me in the right direction, if this is still an issue?

Copy link

@freakboy3742 freakboy3742 commented Jan 21, 2019

@mav-erick It's entirely expected that the core widget doesn't have a set_font method. The core widget has a font property; altering that attribute calls set_font on the backend. My guess is that it's the property setter that needs the rehint call.

(This is a general pattern in Toga - the front end exposes the "most Pythonic" API it can; the backend then defines specific "do X" APIs to implement that frontend design)

Copy link

@RishabhAgarwal-2001 RishabhAgarwal-2001 commented Jun 29, 2020

@freakboy3742 I am facing issue in changing the font and colour of the label widget in Toga Gtk implementation. I tried altering the font property of the label through the code below, but no change was noticed.

class Test_App( toga.App ) :
    def startup( self ) :
        self.main_window = toga.MainWindow( )
        body_box = toga.Box(id='Main Box')
        label = toga.Label("Quick Quiz") = toga.fonts.Font(family='Times New Roman', size=50)
        self.main_window.content = body_box


Is this functionality still to be coded for Linux?

Copy link

@freakboy3742 freakboy3742 commented Jun 29, 2020

@RishabhAgarwal-2001 Well, the fact that the font isn't changing would seem to suggest that it is... :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants