beeware / toga

A Python native, OS native GUI toolkit.

Home Page:https://toga.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Layers or z-index or something else.

Mr2025 opened this issue · comments

What is the problem or limitation you are having?

As designer, I want to be able to place labels over backgrounds, so that I can create more excitement for my application.

Describe the solution you'd like

I don't have a preference as long as when I am creating an object, I ensure it appears over the other object.

Describe alternatives you've considered

CSS style z-indexing.

Additional context

No response

Thanks for the suggestion. However, before we add Z-indexing, we'd need a way to layer widgets on top of each other. At least at present, that's not an option with Toga's layout tools.

However, it sounds like the underlying feature request here is to allow for background images on box widgets. This has been previously raised as #1800; I'm going to close this feature request as a duplicate of that one.

That feature request is something that is a lot more achievable - not easy, mind you, but achievable. Windows in particular is going to have problems, because of the weak support for alpha blending transparency in widgets.

My initial draft of an API would be to use the background_image style directive (and related styles like background-size and background-repeat), where url() references will be passed directly to toga.Image objects as resource paths.

With that said - I would also strongly counsel against using background images. Every example I can think of where a background image is being used, it's been used:

  • To implement skeuomorphism; or
  • For ✨ design ✨ reasons - a UI designer is being creative and trying to disagree with the native platform look and feel.

Either way, background images lower contrast and readability of text, and won't honour any user preference for dark mode. To that end, IMHO background images are almost always a bad idea.

I don't know the specifics of your situation, so it's possible you might have a legitimate use case (in which case, I'd be interested to know what it is); but on behalf of your users, I'd also ask you to give very strong consideration to whether a background image is actually needed in the visual design.