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

Open
Dayof opened this issue Jun 7, 2017 · 4 comments

Comments

Projects
None yet
5 participants
@Dayof
Copy link
Contributor

commented Jun 7, 2017

To reproduce this error I made this code https://gist.github.com/Dayof/f25e73a902b3c1d0c2b83dc6e3fba8f9 .

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

1

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:

2

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

3

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

@barryjohnthompson

This comment has been minimized.

Copy link

commented Feb 12, 2018

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

@Donyme

This comment has been minimized.

Copy link

commented Mar 8, 2018

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

@mav-erick

This comment has been minimized.

Copy link
Contributor

commented Jan 21, 2019

@Dayof @freakboy3742 I am facing the same problem as @Donyme. set_font is implemented in
toga/src/cocoa/toga_cocoa/widgets/label.py
But not in
toga/src/core/toga/widgets/label.py
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?

@freakboy3742

This comment has been minimized.

Copy link
Member

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.