Skip to content

How to apply a global style to a parent widget such that all its nodes will inherit that style #1858

Closed Answered by freakboy3742
proneon267 asked this question in Q&A
Discussion options

You must be logged in to vote

There isn't a "cascading" aspect to the implementation of Toga's Pack style engine. The closest you'll get is to either apply the same style to every widget (in the style you've done), or to create a single style definition, and apply that definition to every object:

style = Pack(font_size=32)
main_box = toga.Box(style=style)
label = toga.Label(text="Hello", style=style)

A full "Cascading" stylesheet isn't something we're likely to add to Pack, as we're deliberately trying to keep Pack simple. However, it will be required by Colosseum, which aims to be a full CSS3 implementation. Colosseum isn't sufficiently mature to be used in practice; but it's part of the "long term" picture for BeeW…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by proneon267
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants