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 ability to replace style attribute #2305

Closed
hyuri opened this issue Dec 29, 2023 · 2 comments · Fixed by beeware/travertino#224
Closed

Add ability to replace style attribute #2305

hyuri opened this issue Dec 29, 2023 · 2 comments · Fixed by beeware/travertino#224
Labels
enhancement New features, or improvements to existing features. good first issue Is this your first time contributing? This could be a good place to start!

Comments

@hyuri
Copy link

hyuri commented Dec 29, 2023

What is the problem or limitation you are having?

I want to be able to change a widget's style, by passing another variable containing Pack() styling.

Right now, the style is not changed if I do, for example:

my_style_one = Pack(...)
my_style_two = Pack(...)

label = toga.Label("Step 1", style=my_style_one)

label.style = my_style_two

Even if I use label.refresh() afterwards.

Describe the solution you'd like

Be able to re-assign a style like so:

label.style = new_style

Describe alternatives you've considered

A method for updating properties, such as:

label.update("style", new_style)

Additional context

No response

@hyuri hyuri added the enhancement New features, or improvements to existing features. label Dec 29, 2023
@freakboy3742
Copy link
Member

widget.style.update(**new style) already exists.

However, I agree that assignment of a complete style should also be possible.

@freakboy3742 freakboy3742 added the good first issue Is this your first time contributing? This could be a good place to start! label Dec 30, 2023
@drewlar
Copy link

drewlar commented May 20, 2024

Going to picking this up at the Pycon US sprint!

@mhsmith mhsmith changed the title Add ability to change style Add ability to replace style attribute May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New features, or improvements to existing features. good first issue Is this your first time contributing? This could be a good place to start!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants