Let me give an example. In the Increment/Decrement we see the following Python code:
def index():
return pc.hstack(
pc.button(
"Decrement",
color_scheme="red",
border_radius="1em",
on_click=State.decrement,
),
pc.heading(State.count, font_size="2em"),
pc.button(
"Increment",
color_scheme="green",
border_radius="1em",
on_click=State.increment,
),
)
Which is supposed to build the interface for this almost-too-simple example. Note how there is a lot of custom Python code for simple HTML and CSS things that are already directly available in, well, HTML and CSS. This is how it might look like instead (pardon the inline CSS, it's just a quick comment, you can of course make this much better by writing the CSS separately): Decrement
0
Increment
Then in the Python side, something like: pc.event(id='dec_btn', type='on_click', action=State.decrement)
pc.event(id='inc_btn', type='on_click', action=State.increment)
# Runs everytime the State changes (or something)
def global_update():
pc.print(id="count_h", f'{State.count}')
This way, presentation is separated from business logic, and 'everything in its right place' (c).I understand that many (most?) Python developers would like to stay away from JS, but I expect that most developers will know 80% of what is needed from basic HTML/CSS in order to do something like this. If they don't, it should be really easy to learn. I mean, come on, basic HTML/CSS is like a foundational building block of computing, and anyway, to write "HTML-in-Python" you still need to learn the basics (and then twist them into their Python doppelganger).