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

is group() necessary? #2

Closed
iansparks opened this issue May 8, 2021 · 1 comment
Closed

is group() necessary? #2

iansparks opened this issue May 8, 2021 · 1 comment

Comments

@iansparks
Copy link

Hi, interesting work.

I have a question about group(). Do you really need it? In one example you use:

 group(DIV(Class="row"), [
                    group(DIV(Class="col-sm form-group"), [
                        LABEL("Enter Title", to="inputt", Class="form-label"),
                        #This beautiful syntax is part of python. the :=(beaver) operator returns an object and stores it to a variable, which we can modify
                        title := INPUT(id="inputt", type="text", Class="form-control"),
                    ]),
                    description := group(DIV(Class="col-sm form-group"), [
                        LABEL("Enter Description", to="inputts", Class="form-label"),
                        TEXTAREA(id="inputts", type="text", Class="form-control")
                    ]),
                ])

but brython does allow you to build this same structure using lists of nested elements:

DIV([
                  DIV([
                        LABEL("Enter Title", to="inputt", Class="form-label"),
                        #This beautiful syntax is part of python. the :=(walrus) operator returns an object and stores it to a variable, which we can modify
                        title := INPUT(id="inputt", type="text", Class="form-control"),
                    ]),
                    description := DIV([
                        LABEL("Enter Description", to="inputts", Class="form-label"),
                        TEXTAREA(id="inputts", type="text", Class="form-control")
                    ], Class="col-sm form-group"),
                ], Class="row")
@dewball345
Copy link
Owner

It does? i didn't realize that! If that is the case, then the group function really isn't necessary.

If i get time, I will change the source code.

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

No branches or pull requests

2 participants