4 ms·
I do not want to sound in a bad way, though if you need to create very simple GUIs with Python, what's wrong with Tk?
by trymas 9y ago
I do not want to sound in a bad way, though if you need to create very simple GUIs with Python, what's wrong with Tk?
- tasty_freeze 9y agoI'm out of the loop, but I have never seen a Tk interface that didn't look straight out of 1997. Also, many people are "fluent" in HTML/javascript/python, but aren't so familiar with Tk.
- istjohn 9y agoAlso, there are a lot of great libraries (e.g., for visualizations) in JS that this would allow you to use.
- trymas 9y agoYes, I know that, though if I'd want a simple GUI in few lines of python probably it's something not client facing and internal use only, thus design aspect is not bothering me. Simple, functional cross-platform GUIs with Python and Tk is a very nice thing. If we talking cross-platform production ready, pretty GUIs, probably Python is not the best choice or if we insist on Python, then in pair with something like Qt
- JetSpiegel 9y agoThemed TK uses native widgets and it presents the same basic API. It's distributed by default too, it's not an external library. You can use both the old and the new widgets in the same GUI. For simple GUIs it's easy to use and the code is clean and extendable. There is a canvas object for arbitrary graphics or custom widgets, but without OpenGL support they look ugly and it's not performant. The existing widgets are the basic, so no high-level stuff like date-pickers. As for the layout "language", there are 3 layout managers that CSS has only begun to reach feature parity: - "pack" which is like flexbox - "grid" which is like CSS Grid - "place" which is like absolutely positioned elements All this can be mixed and matched. With a couple hundred lines of Python you can do a React-like and bind tightly the entire GUI state to a complex `dict` that can be serialized to JSON in a couple of lines. Don't discount Tk just yet.
- vram22 9y ago>With a couple hundred lines of Python you can do a React-like and bind tightly the entire GUI state to a complex `dict` that can be serialized to JSON in a couple of lines. Don't discount Tk just yet. Why would you want to serialize it to JSON? To send it to a server or something like that?
- JetSpiegel 9y agoMostly for persistence. Save it into a file, restart the program and load the entire state losslessly. You can also send it to a server or do whatever you want. With the correct widget types, the business state IS the GUI state and can be treated the same. For simple GUIs, there will be no redundancies and no undefined states.
- vram22 9y ago>Mostly for persistence. Save it into a file, restart the program and load the entire state losslessly. Interesting, and makes sense. Coincidentally, just today I was remembering the feature of the Palm IV or V that I used to have (also the Palm Zire later, but don't remember if the latter also had the feature), of saving app state, so that when you turn it on again, all apps would be running (or was it only single-app-at-a-time, don't remember) with their exact state preserved from when you shut it down, down to even the last characters entered in the middle of a field in a form that you were filling in, for example. Also it was an almost instant-on kind of device. And was wishing that my PC / laptop could be that way too. I had read a while ago that some work had been done on much faster booting times for Linux or other OS-based PCs. Don't know the current status of such efforts.
- ChrisKnott 9y agoPersonally it was because I wanted to use some widgets from jQueryUI, but mostly people are just lazy and they happen to know HTML/CSS/JS already
- ethanpil 9y agoRight. HTML seems like a lot for a small app. I have had some success with AppJar. It might not be the fastest but its super intuitive and easy... http://appjar.info http://appjar.info