lawsie / guizero

A Python 3 library to allow learners to quickly and easily create GUIs.
https://lawsie.github.io/guizero
BSD 3-Clause "New" or "Revised" License
406 stars 81 forks source link

Updating Element Values of Method-Created Objects within a Drawing #498

Open Zephurah opened 10 months ago

Zephurah commented 10 months ago

Is your feature request related to a problem? Please describe. To create a background image and have text overlaid correctly with easy positioning, it is convenient to have all text elements within one drawing element. For example if creating three text elements within a Drawing, you would use backgroundImage.text(...) three times. However, if you then want to change the values of the text within the Drawing, they need to be redrawn and redeclared every time, which results in large amounts of object IDs being created, depending on the period at which they are redrawn. Currently I am deleting the un-used elements from behind the current elements by logging the element ID, then deleting the ID from the previous update via backgroundImage.delete(elementID - n). This works but is less than ideal.

Describe the solution you'd like It would be fantastic to be able to directly edit the values of the elements within a Drawing, similar to how text properties can be edited as text.value = ...

Ideally each element would be assigned a unique ID that does not change, and the values of that element could be changed similar to: backgroundImage.text[1].textValue = ....