Replies: 4 comments 3 replies
-
Yes, the idea of a "Toga markup language" has come up many times in the past. It wouldn't even be that hard to develop - Toga's layout is, after all, very much modelled on HTML: boxes inside boxes, with style applied to each node. That maps fairly trivially to a markup language. To date, it hasn't been a priority, mostly because of personal preference. There's clearly an audience that loves the idea of GUI markup languages, but for me, it's Yet Another Markup Language. I know Python. Python is much more powerful and flexible than any markup language. Introducing a new markup language with its own syntax, quirks and limitations instead of just writing Python doesn't strike me as a major source of productivity gain. It also seems more important to me to have a suite of good widgets than a second mechanism for laying out those elements. That said, it keeps coming up, and there isn't an open ticket describing the request, so I've opened #2293 to track the idea. |
Beta Was this translation helpful? Give feedback.
-
I was initially interested in this as well, but then I realized we really "already have it" but in Python syntax as @freakboy3742 mentioned. The example you gave on #2293 is pretty much what we can already do in Python— but we can do more with Python. In fact, we can pretty easily break our code down into the 3 different components — layout, styling, and logic — just like we would with HTML + CSS + Code(Python/JavaScript/etc.). Here's a rough example: Layout
Styling
Then, assuming you have a Logic
Two things to note:
So now, after toying around with Toga, I think the markup option is a nice bonus but definitely not necessary. I think we benefit more by focusing on improving Toga, like fixing issues with vertical centering, background images support, making more widgets available, etc. I think the example above can be improved, especially by using classes and inheritance, but it already provides good separation of layout/styling/code and greatly simplifies creation and maintenance of pages. I hope to soon post a complete template that showcases the approach above, with other accompanying functionality to make it very easy to use, that can also give newcomers a headstart with BeeWare/Toga. Let me know if that's something useful and I can share it here when it's up. Note: The code above is a stripped down version of an app I'm building, so I didn't test before posting here, so it might not work without a few tweaks/fix-ups ;) |
Beta Was this translation helpful? Give feedback.
-
Thanks for the example, after playing a little more with toga, I realized that a markup language is not so necessary, toga is simple and powerful, just like python, when I made this post my only experience with GUI was QT and QML, QT is very complicated by default and QML comes to fix this, but Toga does not have this complexity problem like QT or GTK with some complicated names, parameters and functions |
Beta Was this translation helpful? Give feedback.
-
@hyuri could you explain this page system that you implemented in your app, I found the way you implemented it interesting and I would like to implement it in my app too |
Beta Was this translation helpful? Give feedback.
-
GTK are creating a markup language Blueprint following QT which already has QML to facilitate the creation of interfaces and readability, have you guys ever thought about creating one too?
I think it would be a very welcome feature and would increase productivity and interest in the project
Beta Was this translation helpful? Give feedback.
All reactions