Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-evaluate having widgets for raw HTML constructs #676

Open
FFY00 opened this issue Nov 14, 2020 · 1 comment
Open

Re-evaluate having widgets for raw HTML constructs #676

FFY00 opened this issue Nov 14, 2020 · 1 comment

Comments

@FFY00
Copy link

FFY00 commented Nov 14, 2020

Hey,

In the past, there were widgets for raw HTML elements and it was possible to define standard HTML layouts in a pythonic way.

with flexx.ui.html.Div(css_class='container'):
    with flexx.ui.html.Div(css_class='row'):
        with flexx.ui.html.Div(css_class='col-sm-2'):
            ...
        with flexx.ui.html.Div(css_class='col-sm-10'):
            ...

Currently, we are forced to do this in _render_dom with create_element, which is really annoying and very hard to read.

Would it be possible to reconsider bringing something like the old API back? I am totally fine with it having limitations like not being able to mix normal flexx widgets with raw html widgets.

IMO, the current approach is unusable, when scaled, for "normal" web development. I see two possibilities to fix this, either introducing a pythonic way to construct raw html, or taking a step back from the widget abstractions and use templates, something like jinja or mako. The last, of course, has a downside of the user having to manually register the flexx events, and even potentially not being compatible with how flexx works(?).

What drew me to flexx was that it builds on top of the standard web technologies, which means that I can have very flexible, customizable, and modern GUIs. It also has other very nice effects, like making it really easy and approachable for users to have their own themes, which is refreshing in face of the other available desktop GUI technologies. Having the project not work well for paradigm is wasted potential IMO.

Cheers,
Filipe

@almarklein
Copy link
Member

The reason for the _render_dom approach was to get a more declarative way to define the low-level content of a widget, which is also more lightweight than a deeply nested tree of Flexx widgets. The way of writing it down is indeed different, but it somewhat resembles React, so it should actually be familiar to front end developers.

That said, I think it should be quite easy to define your own Div, H1, etc. classes by implementing _render_dom once, and then use that in the rest of your code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants