top | item 40891446

Kivy – a cross platform Python UI framework

205 points| peanball | 1 year ago |kivy.org

104 comments

order

goffi|1 year ago

There is a galaxy of projects around Kivy, such as https://github.com/kivy/python-for-android to compile python project for Android (with Kivy or not) or https://plyer.readthedocs.io/en/latest/ for cross plateform API (notifications, hardware, filechooser, etc).

For UI there is https://github.com/kivymd/KivyMD for Material design on top of Kivy.

And the team is nice (I've met some of them at PyCon or FOSDEM).

The framework is pleasant to use, and there is a descriptive language, kv, which is really great.

Cross compiling may be painful though (I did it for Android) and the app loading time is a bit long, but it's working.

Some things may be missing in comparison to big frameworks such as Qt, there is no WebView for instance, and accessibility is unfortunately not as good.

It's overall a very good project and it's a pity that it's not more known and used.

graemep|1 year ago

I used Kivy once a few years ago for a device that had strict constraints on what it could run with the requirement to run the same code on desktop too (to display the same data). It worked very well for that.

It was not an elaborate app, so I cannot comment on how well it might work with something bigger, but it worked very well for what I needed.

m_kos|1 year ago

Thanks for sharing your experience and links! Based on plyer's GH, it looks like you could use it to develop an iOS and Android app. If it supported more APIs (like Health Kit, accessibility), I would try it in a heartbeat.

https://github.com/kivy/plyer

cardanome|1 year ago

So how is the accessibility story?

No mentions on the site at all. I only found this https://github.com/kivy/kivy/issues/8596 so seems like not yet implemented.

Meaning Kivy is not yet a good choice for user-facing apps. It is so frustrating to see all the new UI frameworks and they fall apart if you just ask about accessibility features that should be absolute standard in 2024.

dec0dedab0de|1 year ago

I think first tried Kivy in 2013, I wouldn’t call it new.

bmitc|1 year ago

Is there a cross-platform accessibility library? I can tell you that developing a cross-platform GUI framework is a gigantic can of worms fraught with forced yakshaving, no documentarion, no support, and endless bugs across the stack even down into the OS and GPU driver stack. So in my opinion, everyone asking for accessibility features on every GUI framework announcement should get together and make a GLFW for accessibility libraries so that it can indeed be standard.

gostsamo|1 year ago

I've heard some good things about beeware, but haven't tested it myself, so not sure. Most people I know use either qt or WX python.

cglong|1 year ago

The landing page is weird; it talks more about the funding for the framework than the framework itself. There's only one image showing UI, and the way its styled (cropped, tilted) makes me think its a stock photo, not a screenshot. The stock photo of a train right underneath isn't helping this perception for me.

If you got as lost as me, the Gallery is accessible via a link at the top: https://kivy.org/gallery.html

BiteCode_dev|1 year ago

Note that those are not stock widgets.

And that's one of the main show stopper for me with kivy: it comes with very few built-in UI controls, so you have to code a lot of things yourself.

I much prefer Python to JS, but things like react native win because of the community libs you can install save you tons of time, and produce a better result.

kennydude|1 year ago

Yeah the stock photography feels really off to me as well and not really helping show off what the project is. Strange vibes

tzury|1 year ago

It’s 2024.

None of the screenshots under the gallery are compelling or even acceptable these days.

https://kivy.org/gallery.html

Electron thus far seems to be the king of “desktop” ui.

KaiserPro|1 year ago

> Electron thus far seems to be the king of “desktop” ui.

For people that want to use the webstack, yes. But that's not everyone.

A fast, fairly simple GUI system thats GPU accelerated is pretty rare

even rarer if you want python support.

mikrotikker|1 year ago

Please anything but electron dear god

winrid|1 year ago

FWIW JavaFX is still great too BTW. I have a decent sized app that'll run fine with a 50mb heap, and you get native OS installers too. No web support though.

victor106|1 year ago

Does it appear native? And I keep hearing that even though swing is really old, it has better performance and that it’s used by IntelliJ. Not sure though

serial_dev|1 year ago

One cross platform Python framework I found interesting is flet https://flet.dev/

It's powered by Flutter behind the scenes and familiar enough so that you can translate most things from Flutter/Dart tutorials to Flet.

I haven't used it and I'll most likely never will (Flutter developer trying to pivot to real native development), but it seems to have an active community, and in theory, it enables developers to write relatively nice looking apps with a very popular language.

BaculumMeumEst|1 year ago

Why do people keep doing things like investing in a framework, written by one set of developers, built on another framework, written by another set of developers, and acting like that is not insane? Unless both stacks are written by huge software companies that have an extreme vested interest in keeping them running, there is a huge risk of abandonment. Maybe Google just decides maintaining flutter is a pain in the ass and React Native is just good enough. Maybe the flet devs don't turn enough profit. Maybe flutter changes too radically and makes it difficult for flet to catch up. Such situations have happened again and again and again, and they will continue to into the future. What are we gaining here that is worth such an enormous risk?

insane_dreamer|1 year ago

Interesting. Looking for something like this to use instead of Flask, which is great on the server side but need something that’s easy to work with on the client side that provides a feature complete and nice looking set on controls for the client side.

heavyset_go|1 year ago

Last time I looked at Flet, it gave the impression that you had to use the wrapped Flutter widgets, making it hard to use widgets and packages from pub.dev in a Flet application.

BiteCode_dev|1 year ago

What do you mean by "Flutter developer trying to pivot to real native development" ?

mark_l_watson|1 year ago

I wrote one iOS app using Swift and SwiftUI. Has anyone written a Kivy iOS app and pushed it to the app store, if so, please share experiences.

eonpi|1 year ago

Wrote a fairly complete POC in 2012 with kivy, it was able to render rather detailed floor plans, which was the most important feature of the POC since the idea was that, given the complexity, it should be written once and be able to run on multiple platforms with minimal changes, keeping in mind that mobile platforms were the priority.

Most impressively, it was running very well on a first generation iPad, not to mention Android tablets, and of course, Mac, Windows, and Linux workstations.

It was ultimately dismissed by the stakeholders because there was no way to render a web page inside the App, which was something kivy couldn't do back then.

xyproto|1 year ago

Katrain uses Kivy and is problematic to package and upgrade because of it, on rolling release distros. When installing it with pip, it partially works.

From a packaging point of view Kivy is not great.

7thaccount|1 year ago

All of Python is pretty terrible from a packaging perspective.

pyeri|1 year ago

I feel like an old grandpa while using tkinter!

analog31|1 year ago

I still use tkinter for apps that I make for my own use. Those are often for lab automation, where a primitive GUI lets me avoid needing 3 hands while running an experiment, and the support for live graphs is extremely useful.

For stuff that I'm likely to share with others, I've been moving over to Flet, because it lets me build things like webapps and stand-alone Windows apps. Both of those things can eliminate the hassles of installing Python apps as experienced by non-programmers.

I hate writing GUI code, and in both cases have written crude wrappers that let me throw together a functional dialog with tolerable defaults for everything. This approach works for "programmers who shouldn't trust themselves to write GUI's," similar to the old Visual Basic.

openrisk|1 year ago

For Kivy to stop being a niche UI framework with marginal adoption it must somehow tap into the central role of Python in the broader data science / machine learning universe.

Building data-centric cross-platform apps while staying (mostly [1]) within a single language ecosystem should be less friction and overhead than juggling multiple universes via API's, different runtimes and what not.

What kind of apps would benefit from this "single language" approach? For sure not the more open ended, exploratory data science type tasks. These are better delivered via notebook workflows, which, besides flexibility, enable better reproducibility and auditing. Also probably nothing that requires high performance interactive graphics.

But while not solving all UI problems for all people, there should be still plenty of relevant use cases where simplicity and fast prototyping give Kivy an edge when the task is to make algorithms and related tools available to non-technical users.

[1] ofcourse the actual number crunching might be done by yet another layer (typically C/C++) but that layer is essentially hidden from the data orchestation and UI integration that would be the Kivy app focus.

ChrisChou|1 year ago

I have been following the progress of this project for the past two years, but unfortunately the community support does not seem to be ready to take this project anywhere. The most basic app store in-app purchase support is directly rejected. If an application framework cannot quickly help people get started, how can it get people's support?

kerkeslager|1 year ago

I've kept an eye on Kivy for quite a while and prototyped a bunch of projects over the years with it, and I'm not a big fan.

It feels like it's at the wrong level of abstraction for... basically everything.

The Pong game demo is an example of this: if you're writing a Pong clone (or most video games) where you're going to be operating on a canvas, you don't need all the widget infrastructure that Kivy offers--you're better-served by something like PyGame.

On the other hand, if you want to build a UI using standard widgets, the widgets they provide out of the box aren't particularly fully-featured or even good--you end up doing a lot of hand-coding of functionality that could be included, and the defaults aren't particularly desirable, so you end up having to configure a lot of, for example, visual display settings.

As another user pointed out, their default widgets don't support accessibility meaningfully, and there are many other features, such as dark mode/color scheme support, which modern users expect and which you'll have to code yourself. Realistically, a lot of clients aren't going to give you funding for accessibility features, so the defaults are what most projects will end up with, and if it's me developing it, I'm doing accessibility on my own time, so I'd want this to be configuring what's largely already there, as opposed to what Kivy has: implementing it from scratch. In 2024 I'd view failing to support accessibility reasonably out of the box, as almost a moral failing, and certainly this is enough to discount Kivy from being used for any product intended to go to production.

There IS a fairly vibrant ecosystem of 3rd-party widgets (flowers; there's a "garden" metaphor in their branding for the ecosystem). But this comes with all the problems of a 3rd-party ecosystem: Kivy itself is probably large enough that it won't become abandonware in the forseeable future, but 3rd-party projects aren't, and there are large security and reliability risks to pulling in a bunch of small packages maintained by developers of various talent, intention, and funding. These are risks you generally have to accept for something unusual, but you shouldn't have to accept these risks for your bread-and-butter widgets like buttons and dropdowns.

If you're embarking on a project that benefits from using pre-built widgets like this, the framework I'd recommend is Flet. My experience with it has been overwhelmingly positive, and I've entirely switched away from PyQt for any new projects. The one criticism I'd give is that it doesn't really support multi-window, but that's something I'd avoid for most projects because multi-window support can never really be cross-platform, since mobile platforms don't really support windows as such.

OJFord|1 year ago

Docs > Getting started's only code is in a screenshot? (That doesn't render properly, legibly, at least for me right now, on mobile?)

dzonga|1 year ago

out of all cross platform tools - dart / flutter is probably the easiest one. performant comes with all the widgets you want.

web, mobile etc. react paid my rent but never again.

brnt|1 year ago

Flet doesn't seem to have a Treeview. I find that actually few cross platform GUI toolkits do. Qt, Swing, Wx, but the trendy ones?

kumarvvr|1 year ago

All these types of frameworks, ones that have code to make their own UI are fine, but what I really want is to have a declarative UI, like HTML or XAML, bound with some user interaction event engine and access to the underlying OS.

Hopefully, we can have that someday, without the likes of Electron or whatnot.

I would like to write a react app, with all its progress in UI/UX and thousands of libraries, package them into a Python app and distribute it as a desktop application.

jennasys|1 year ago

Kivy gives you a pretty good separation of logic and UI with its declarative yaml-like kv files. For me, it conceptually feels a lot like developing in React.

mig39|1 year ago

Does this work with JupyterlHub? Would be neat to try with some students currently learning Python with JupyterHub.

bionhoward|1 year ago

Every time I see a claim some thing is “the thing” I wonder about how many other things do similar things

fefferkorn|1 year ago

i like nicegui, but its more a web ui framework thing than a fully fledged desktop ui.

dang|1 year ago

Related:

Python dev considering Electron vs. Kivy for desktop app UI - https://news.ycombinator.com/item?id=39889274 - March 2024 (9 comments)

Python app development for beginners – Kivy mobile app tutorial - https://news.ycombinator.com/item?id=26935529 - April 2021 (9 comments)

Kivy: Cross-Platform Python Framework for UI Development - https://news.ycombinator.com/item?id=25484451 - Dec 2020 (55 comments)

An update on Python-for-android: v2019.06.06 released and future plans - https://news.ycombinator.com/item?id=20133966 - June 2019 (7 comments)

Kivy 1.10.0 released - https://news.ycombinator.com/item?id=14297890 - May 2017 (33 comments)

Python for Android - https://news.ycombinator.com/item?id=13964561 - March 2017 (61 comments)

Kivy: Develop multi-touch enabled Python apps - https://news.ycombinator.com/item?id=12127158 - July 2016 (45 comments)

Kivy 1.9.1 released - https://news.ycombinator.com/item?id=10827322 - Jan 2016 (22 comments)

Python on Android - https://news.ycombinator.com/item?id=9482618 - May 2015 (49 comments)

Kivy 1.9 – A framework for creating novel and performant user interfaces - https://news.ycombinator.com/item?id=9315404 - April 2015 (16 comments)

Kivy – Open-source Python library for rapid development of applications - https://news.ycombinator.com/item?id=8181306 - Aug 2014 (47 comments)

Python on Android? First impressions of Kivy - https://news.ycombinator.com/item?id=4677863 - Oct 2012 (10 comments)

Kivy - Open source cross-platform library for rapid development - https://news.ycombinator.com/item?id=4601016 - Oct 2012 (23 comments)

Kivy: python UI framework. GPU accelerated, multi-input (win,osx,lin,android) - https://news.ycombinator.com/item?id=2773488 - July 2011 (18 comments)

holistio|1 year ago

Am I the only one who read Kyiv?

bbor|1 year ago

A) this is most European website I’ve ever seen. I couldn’t tell you exactly why… perhaps it’s the train subconsciously affecting me.

2) this is first time I’ve ever seen mobile included as part of “Cross-Platform”, that’s pretty awesome. We’re living in the future, friends! Tho it also makes me shudder at the thought of the phrase “QT app development”…

III) At this point, why not just use web? What is a “truly cross platform UI framework” other than HTML? I’m currently developing a site that uses TS in the frontend and Python in the back, and that seemed like a nice Unix-y division of labor. What am I missing?

jb1991|1 year ago

> this is most European website I’ve ever seen. I couldn’t tell you exactly why… perhaps it’s the train subconsciously affecting me.

Actually the train on that page is from Japan.

KaiserPro|1 year ago

> this is most European website

nice, I love casual exceptionalism in the morning.

> At this point, why not just use web

Because not everyone uses a "web stack". Moreover trying to learn a webstack is pretty hard. Sure JS is easy, but everything on top to make it more "productive" changes every 6 months. I mean yeah I could just use react, but Urgh, its nasty.

However the killer issue issue is hardware acceleration. Its possible to get kivy running at 60 FPS on a pi3. getting something to run at 60fps on web for the pi3 is bloody hard. Even though its python, it runs really fast, something not really possible in the browser.

ranger_danger|1 year ago

I think a lot of people dislike html/web-based apps, and they are not as responsive in some cases as well. I have seen some mobile browser implementations that explicitly put large delays (hundreds of ms) into their touch handlers for example. You can see a similar delay in a side-by-side comparison video here https://www.youtube.com/watch?v=Z4CwVN9RRbE