toga
toga copied to clipboard
Add ability to replace `style` attribute
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
widget.style.update(**new style) already exists.
However, I agree that assignment of a complete style should also be possible.
Going to picking this up at the Pycon US sprint!