toga icon indicating copy to clipboard operation
toga copied to clipboard

Add ability to replace `style` attribute

Open hyuri opened this issue 2 years ago • 2 comments

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 avatar Dec 29 '23 05:12 hyuri

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

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

freakboy3742 avatar Dec 30 '23 00:12 freakboy3742

Going to picking this up at the Pycon US sprint!

drewlar avatar May 20 '24 20:05 drewlar