24
u/spencerbot15 Aug 03 '19
What are the advantages and disadvantages of this vs Kivy?
32
u/something Aug 03 '19
Main advantages of my thing - You write in python instead of separate markup language, and this is native components so you get the native look-and-feel and accessibility. Disadvantages are that this is the result of a few hours of work so it's not exactly production ready
9
u/Isvara Aug 03 '19
What about compared to Qt?
9
u/something Aug 03 '19
Qt also requires it's own DSL and I'm not entirely sure it's native components or reimplementations of native controls. On the other hand Qt is also a lot more mature and has documentation
3
u/Isvara Aug 03 '19
Oh, really? I thought Qt's DSL was optional. It's been so long since I looked at it, though.
11
u/something Aug 03 '19
I think it's optional but otherwise you write your views in a much more imperative way by manually adding subviews to views. This way is quite labourious and error prone in my opinion, so I prefer a declarative approach
5
2
Aug 04 '19
Actually I think in Kivy you can achieve the thing you do using the markup, fully in Python, just way more verbose. Am I wrong?
15
u/TheV295 Aug 03 '19
This looks awesome, is it opensource?
10
u/something Aug 03 '19
Hi thanks for the interest, I said elsewhere it's very early prototype so expect the code to be terrible right now
19
u/TheV295 Aug 03 '19
Dude if this code is terrible I should just retire
4
u/Fissherin Aug 04 '19
Yup. Keep doing this, you may be creating a full functional "react" for python. I think lot's of people are willing to help you right now.
I never did an open source solutions for someone else. I will read and see if I can help somehow. :)
33
u/sharkbound github: sharkbound, python := 3.8 Aug 03 '19
is this on git yet? would love to peek at the code
16
u/something Aug 03 '19
It's very early prototype so expect the code to be terrible right now
11
u/CaptainTuffnut print('Hello There') Aug 03 '19
First get the things to work. Then prettify the code
6
35
7
u/JackieTrehorne Aug 03 '19
There’s the enaml framework as well. Worth checking out if you’re interested in declarative UIs.
6
u/something Aug 03 '19
Very interesting, thanks for the link. Looks like a slightly different goal because it actually extends the python grammar but I'm looking to write directly in python
1
u/JackieTrehorne Aug 03 '19
Agreed - it’s a different implementation; I’d prefer pure declarative python as well :)
5
u/seansleftnostril Aug 03 '19
Is this based on Cocoa from iOS?
6
8
u/GlipGlorp7 Aug 03 '19
I’m pretty sure that Cocoa is the macOS framework, and Cocoa Touch is the iOS framework.
2
u/naringas n00b Aug 03 '19
very interesting!
can you share the git repo?
3
u/something Aug 03 '19
Hi thanks, https://github.com/jakecoxon/py-gui will clean it up to a usable state at some point
62
u/wdroz Aug 03 '19
If you are looking for a good ui cross-platform library in Python, I recommend Kivy
36
u/ShanSanear Aug 03 '19
I have bounced off Kivy. Not sure if it had more to do with additional .kv files or having to create my own widget using both Python and Kivy language to do so.
PyQt/PySide felt more natural to me and with way better documentation and support.
11
u/MakesYouAngry Aug 04 '19
I always felt like the Kivy thing was advertised without any good reason -- it doesn't seem great for making desktop applications, at least not when compared to PyQt/PySide. It seems to be good for small to medium-sized games and proper Android/mobile applications. Am I completely wrong here? PS: I have used Kivy before to make a small dungeon crawler and Match-3 clone.
2
8
Aug 03 '19
Downloaded and installed this last night actually. Took a little bit longer under linux than I thought, but looking forward to trying it out.
4
u/maxxfrag Aug 03 '19
Any good resources to learn kivy?
6
u/wdroz Aug 03 '19
In the getting started section, the tutorials are good. There are some books on Kivy in packtpub if you like books.
5
u/that_empath_guy Aug 03 '19
Kivy Tutorials Python: http://www.youtube.com/playlist?list=PLzMcBGfZo4-kSJVMyYeOQ8CXJ3z1k7gHn
3
7
u/coderanger Aug 03 '19
For anyone looking for a more polish (and cross platform) version of this, check out Toga from the BeeWare project: https://toga.readthedocs.io/en/latest/tutorial/index.html#tutorial
2
u/GickRick Aug 03 '19
I would go back to Python in making desktop apps if this was open sourced😭😭😭please do
1
u/something Aug 03 '19
I've posted the repo in the thread, but it'll be a long time before it's actually usable sorry
1
Aug 03 '19
Where can I find more information about this library? I could t find the name online.
2
u/something Aug 03 '19
Hi thanks I wasn't sure whether to make the code available yet - https://github.com/jakecoxon/py-gui
1
u/WhiteHeadbanger Aug 03 '19
Will this have a feature to frontend style the UI with html/css? I'm looking for a python framework that allows me to do that.
1
u/something Aug 03 '19
Hi HTML/CSS isn't really a goal I'm looking for on this project. Out of interest what is the reason? Is it familiarity? I hope to make this as easy to work with as CSS but in python
1
u/WhiteHeadbanger Aug 03 '19
I will try and look at your code anyway, it's pretty awesome what you're doing :) The reason is that I would like to create an original ui, modern and pretty. My goal is to create something like Discord's GUI.
I've been using wxpython and kivy. Wxpython is ugly as hell, and kivy is not that ugly but I'm not sure if I can customize the UI the way I want.
2
u/something Aug 03 '19
Ah I see, this project is more for native-looking components. Kivy might be what you want because it gives you low level primitives to draw your own components but you'll have to do a lot of work to recreate exactly how you want them to look. I do have the beginnings of Kivy bindings in my project so it's possible that I can get it to that point, but I wouldn't hold my breath
1
u/pmdevita Aug 03 '19
Since it targets different platforms, we could make a web target with the help of transcrypt. We'd definitely want to nail down the basics first though
3
1
1
u/blueastheocean Aug 04 '19
coming from me I fell pyqt/pyside2 are pretty good plus it has a designer so you don't have to manually write everything out!
1
u/something Aug 04 '19
Fair point - this style isn’t for everyone. I’ve worked on web for a long time and found visual designers only get you so far. Once you start modifying the UI programmatically based on data it becomes cumbersome or even impossible. I think there is space for this to improve (swift UI looks great) but I don’t think we’re there yet. Not sure if pyqt has this but I reckon I can get hot reloading to work seamlessly
1
u/blueastheocean Aug 04 '19
Pyqt does have a designer
1
u/something Aug 04 '19
I meant the hot reloading part specifically. Out of curiosity does it have that?
1
1
u/jnmclarty7714 Aug 04 '19
Hey, good stuff here. Can I make one or two requests? Please consider naming the project the same as the base package you import from.
People, in the future, will use your project in theirs, and they will screw up declaration of dependencies. But then, their users will get errors. They will have to know that...
Import Error no module named gui
Is fixed by running the command pip install py-gui.
That reverse lookup gui-to-py-gui, is confusing for new users to the python community with no great solution.
Also, a more relevant, specific, descriptive and focused name would help too. There are many things GUI may imply. But, maybe py-react would be better, eh?
Just my two cents. Cool project tho.
1
u/something Aug 04 '19
Thanks for the advice, when the project is a bit more mature and ready to use I'll definitely have a better name, proper imports, documentation, examples, and tests. I don't want it to be called py-gui but it's not close enough to react to have that in the name either, any suggestions?
3
3
u/r0x0r Aug 04 '19
Hey, author of pywebview is here. Have you considered use pywebview as a base instead of doing every platform implementation yourself?
2
u/Ir0nh34d Aug 04 '19
Sent a PR, seems there was a small typo on the cocoa example. Cheers mate, I look forward to this lib growing.
2
1
1
1
1
u/davmash Aug 05 '19 edited Apr 01 '21
Gotta shout out wxPython - now that it supports Python 3 and has completed the wxPhoenix project, I feel like it's got a good future again, plus it is built on a great cross-platform UI system that uses native calls for consistent look-and-feel under the hood (wxWidgets). It has a great Demo that makes it easy to learn, and I've built some serious projects with it (though I am no designer for sure).
0
0
Aug 04 '19
Commit message: 📦
For the love of all that is readable and well tested, please don't.
3
u/something Aug 04 '19
It’s neither readable or well tested at this point so the initial commit message back 4 months ago when it was barely an idea in my head is the least of my worries :)
0
0
Aug 03 '19
I've just been looking for something like that to implement with my apps. Thanks for sharing!
0
Aug 03 '19
Very cool! I’ve never messed around with the GUI modules before. Will have to check them out
-10
u/honkinggr8namespaces Aug 03 '19
Please stop
1
u/something Aug 03 '19
Elaborate?
1
u/honkinggr8namespaces Aug 03 '19
I'm just not a fan of Python libraries that are this un-Pythonic
3
u/something Aug 03 '19
Okay. That wasn't clear from your first message. Do you mind discussing what you feel is unpythonic about API design?
-4
u/honkinggr8namespaces Aug 03 '19
You know what, now that I look at this again, it could work pretty well with a bit of tweaking. Maybe wrap everything in a class or something...
The main thing I wasn't liking is how you're creating these objects and they're somehow implicitly added to the GUI. I think it would be nicer if there was some sort of method call or something involved instead.
Have you looked at Flutter? Their API is certainly not perfect but there are a few good ideas in there
2
u/something Aug 04 '19
Personally I don't feel that wrapping things in classes is something you should look towards.
The library is heavily inspired by Flutter actually, but I chose to write the API like this because python pushes you to write things in an imperative way over functional expressions
Eg
with Container(): Label("A") if show_something: Label("B") Label("C")Is a lot harder to write in an expression
Container(children=[ Label("A"), *[ Label("B"), Label("C") ] if show_something else [], ])Not to mention for loops and flattening more than 1 level deep.
Dart actually modified their language to support this constructs directly in collection literals https://medium.com/dartlang/announcing-dart-2-3-optimized-for-building-user-interfaces-e84919ca1dff
1
u/honkinggr8namespaces Aug 04 '19
Yeah I definitely prefer the context manager system over what Flutter does.
-30
0
145
u/something Aug 03 '19 edited Aug 03 '19
This is a work-in-progress thing I'm working on. It outputs native components and uses a react-like declarative API for defining the api. The layout algorithm is based on the one from Flutter, this means it could target different platforms with the same API. I feel like this would be a lot easier to get stuff done than the alternatives Qt, Tkinter etc
Prototype code here https://github.com/jakecoxon/py-gui not in a usable state yet