Is including arbitrary Qt widgets doable (whether now or in the future)? A lot of my use cases for PyQt5 revolve around QWebEngineView; would be great to be able to throw that widget into a Guietta layout with the extra buttons and such I'd be using around it.
Guietta – Python module to create simple GUIs
151–160 of 166 posts
Re: Guietta – Python module to create simple GUIs
#152But will quickly devolve into a morass if you need to do anything beyond a simple grid.
Re: Guietta – Python module to create simple GUIs
#153This is so timely! I am teaching CS to some high-schoolers and they just got introduced to Python, I want to hook them by getting them to make something that they can play around with. Could use this there :D Somehow, it feels like, CS education is getting both easier as new low friction tools are being made available each day and getting harder because the sheer complexity and number of things to know to really unde…
Whenever you encounter a new programming topic for the first time, it helps a lot if you encounter it in a fairly universal format.
I'm not sure about Python, but in most languages, there are simple GUI libraries that accomplish both of your goals: exciting students with interactive programs and helping them more deeply understand how GUIs are usually built and maintained.
Re: Guietta – Python module to create simple GUIs
#154This is so timely! I am teaching CS to some high-schoolers and they just got introduced to Python, I want to hook them by getting them to make something that they can play around with. Could use this there :D Somehow, it feels like, CS education is getting both easier as new low friction tools are being made available each day and getting harder because the sheer complexity and number of things to know to really unde…
Honestly I would advise against this for beginning coders. It's very "magical" -- there's no easy way to see how the text translates into a UI. It gives them no additional understanding of GUIs at all, really. Whenever you encounter a new programming topic for the first time, it helps a lot if you encounter it in a fairly universal format. I'm not sure about Python, but in most languages, there are simple GUI librari…
Stuff like this is IMO the best way to learn programming for average people, because the first two blockers are usually:
* you don't understand what problem you are trying to solve
* it is all to abstract and you don't know what the thing you are doing actually is
Seeing what you do is a good way to deal with these points, because then programming can feel more like drawing a doodle instead of doing your taxes. Once they got the basics you could still dive into the rest.
Re: Guietta – Python module to create simple GUIs
#155This is so timely! I am teaching CS to some high-schoolers and they just got introduced to Python, I want to hook them by getting them to make something that they can play around with. Could use this there :D Somehow, it feels like, CS education is getting both easier as new low friction tools are being made available each day and getting harder because the sheer complexity and number of things to know to really unde…
IMO this would be the best way to start learning any programming language, because there is an simple IDE with examples, it is very visual and helps to convey basic programming structures just by doodling around.
If I (as a open source python dev) had to teach teenagers I would start with this
Re: Guietta – Python module to create simple GUIs
#156Does it support reactive data binding? Like: https://github.com/Bomberus/LayoutX
No, you have to manually update widgets assigning them their new value (strings, and for labels also lists and dicts). I will think about such a feature but I have no experience with such dynamic frameworks :)
Then your central state is assigned to a Subject and all widgets have an reference to an observer. As soon as the central state value changes, the callback in the observer is triggered and you can fire the update method for the widget using the central state value.
Re: Guietta – Python module to create simple GUIs
#157>>> from guietta import _, Gui, Quit I am not looking forward to taking over projects using that framework abusing underscore and double underscore magic variables. The underscore "_" is a pseudo reserved variable in python. It is used in assignments like year,month,_ = readdate() to discard the return value and disable the lint warning about it.
Couldn't you simply do something like >>> from guietta import _ as underscore to fix this?
Re: Guietta – Python module to create simple GUIs
#158Earlier quoted context omitted.
Couldn't you simply do something like >>> from guietta import _ as underscore to fix this?
After spending inordinate amounts of time debugging obscure side effect caused by "import as" and "from import". I'd reject that "from import as" on sight in code review.
Re: Guietta – Python module to create simple GUIs
#159Earlier quoted context omitted.
black sorts alphabetically, with standard lib first, then 3rd party imports, and user/local imports last. Blocks are separated by a blank line. `from ..` imports come after `import ..`. Especially the alphabetic ordering is important in my view. Makes parsing/reading and spotting duplicates much easier. It is also PEP8 style [0]. For all these reasons, I think the pyramid style is awful in comparison. 0: https://www.…
Black doesn't sort imports at all.
Since Python imports can have side effects, the order can matter. But to the extent that it doesn't break anything, alphabetically sorted groups seems deterministic and readable.
I think this might be the most popular implementation for auto-sorting: https://pypi.org/project/isort/
Re: Guietta – Python module to create simple GUIs
#160Earlier quoted context omitted.
After spending inordinate amounts of time debugging obscure side effect caused by "import as" and "from import". I'd reject that "from import as" on sight in code review.
Any hints towards what kind of issues those cause? I could see some around relative imports, or something else?
from ssl import sslsocket
import httplib as hlib
You can think of the code above as remapping and/or duplicating the whole library it's importing. Python imports involve complex local and global states (I don't pretend to understand most of it).One direct effect on usage is that users of the library can call "httpclient.sslsocket" and "httpclient.hlib" as if they were provided by the library (the author certainly didn't mean to). This creates problem down the line when the author try to change the internal dependency, and this extends to other code also doing "import httpclient.sslsocket as sslsocket", creating problematic hidden dependencies.
More generally, this affects all import dependent features, like reload(module), mock, sys content, etc... imports are looked up and tracked by full path which doesn't always work as expected when paths are hot patched as above.
I used to work in a python shop (millions of line in total across the organization). Regularly had the problem with interns and new graduates abusing imports as above (sometimes even trying to change the existing imports because they though this was the better syntax). Then they couldn't pass their own tests (every new module must have a test) and asked for help after few hours of trying. Changing to a normal "import xxx" solved the problem. It's not always clear what was the exact issue, except side effects due to imports.