kivy on a browser

3,745 views
Skip to first unread message

krister viirsaar

unread,
Nov 17, 2012, 4:47:07 AM11/17/12
to kivy-...@googlegroups.com
turns out, once I start making commercial apps I need to also have them work in browsers. Are there any plans for Kivy to port there?

Gabriel Pettier

unread,
Nov 17, 2012, 5:37:32 AM11/17/12
to kivy-...@googlegroups.com
There has been research in this direction, it's *possible*, but yet far
from pratical, i wouldn't expect it in the next 6 month.

Le 17/11/2012 10:47, krister viirsaar a �crit :
> turns out, once I start making commercial apps I need to also have
> them work in browsers. Are there any plans for Kivy to port there?
> --
>
>

krister viirsaar

unread,
Nov 18, 2012, 8:20:54 AM11/18/12
to kivy-...@googlegroups.com
is anyone aware of a kivy like application for the web? I would rather keep using Kivy and take another program to the side, than move the whole thing to html.

krister viirsaar

unread,
Nov 18, 2012, 8:23:00 AM11/18/12
to kivy-...@googlegroups.com
hey, or perhaps it is possible to convert the kivy code into python? It doesn't have to stay readable, so it would just be an exporter. Then maybe I'll find a way to run the python in the web.

Mathieu Virbel

unread,
Nov 19, 2012, 5:04:01 AM11/19/12
to kivy-...@googlegroups.com
Hi,

Gabriel already told you that we have only an experiment, that's all.
It's far harder as you might think. First, by translating "kivy" code, i
think you was referring to the kv language. That isn't the point here.

You want to execute python code within browser which is javascript. Our
requirements is to:
- have a GLES 2.0 surface (WebGL is compatible, yeah)
- write a core provider for each image/text/window/... providers
- embed data file into js: all the file access assume a filesystem,
something that you don't have in python
- python / sdl / libpng/ libjpeg ... must be compiled into javascript too
- implement mouse/keyboard provider to inject back the javascript event
into kivy.


So far, we have just an experiment, but that's all. Don't count on it. I
would like to say not in the 6 months, but more in 1 year or so.

Mathieu

Le 18/11/2012 14:23, krister viirsaar a �crit :
> hey, or perhaps it is possible to convert the kivy code into python? It
> doesn't have to stay readable, so it would just be an exporter. Then
> maybe I'll find a way to run the python in the web.
>
> --
>
>

Message has been deleted

Dirk Krause

unread,
Nov 22, 2012, 4:51:03 AM11/22/12
to kivy-...@googlegroups.com
Disclaimer: I don't want to lure anybody into doing this, but ... :-) ... I only want to bring attention to the Emscripten project, which (basically) translates C/C++ code to javascript:

For example, this C++ source code:
translates via Emscripten to this html/JS:
and gives
(or
for the real example)

These guys ported a full 3D FPS to the JS:

Best,
  Dirk


Am Montag, 19. November 2012 11:03:47 UTC+1 schrieb Mathieu Virbel:
Hi,

Gabriel already told you that we have only an experiment, that's all.
It's far harder as you might think. First, by translating "kivy" code, i
think you was referring to the kv language. That isn't the point here.

You want to execute python code within browser which is javascript. Our
requirements is to:
- have a GLES 2.0 surface (WebGL is compatible, yeah)
- write a core provider for each image/text/window/... providers
- embed data file into js: all the file access assume a filesystem,
something that you don't have in python
- python / sdl / libpng/ libjpeg ... must be compiled into javascript too
- implement mouse/keyboard provider to inject back the javascript event
into kivy.


So far, we have just an experiment, but that's all. Don't count on it. I
would like to say not in the 6 months, but more in 1 year or so.

Mathieu

Le 18/11/2012 14:23, krister viirsaar a �crit :

Gabriel Pettier

unread,
Nov 22, 2012, 5:24:14 AM11/22/12
to kivy-...@googlegroups.com
Yes, we are aware of that, and it's part of the current proof of concept for kivy (yes, the whole python compiled with emacscripten, and other libs), but the result, although it works, is far from being usable.
--
 
 

Dirk Krause

unread,
Nov 22, 2012, 7:05:56 AM11/22/12
to kivy-...@googlegroups.com
I see, thank you.

Youhey

unread,
Jan 4, 2014, 12:52:38 PM1/4/14
to kivy-...@googlegroups.com
Hi,
Is there any new results about "Kivy on a browser"? 
Or how far are we from developing once for desktop- and web-Apps via kivy?
Thanks


Am Donnerstag, 22. November 2012 11:24:18 UTC+1 schrieb tshirtman:

audiowerk

unread,
May 17, 2014, 3:36:35 PM5/17/14
to kivy-...@googlegroups.com
Hi,

I'm also wondering if anything new about kivy in the browser is available.

Amirouche Boubekki

unread,
May 20, 2014, 7:36:55 PM5/20/14
to kivy-...@googlegroups.com
Héllo,


On Saturday, May 17, 2014 9:36:35 PM UTC+2, audiowerk wrote:

    Hi,

 

    I'm also wondering if anything new about kivy in the browser is available.

Can people interested in this topic be more precise about their needs?

Because so far from my experience, I don't understand the point. Maybe I am a bit particular because I know javascript and somewhat popular framworks, I don't mind doing web but I still prefer Python. That's why I created Pythonium (pip install pythonium) in the first place.

Emscripten (+ asm.js) thing is nice, but sincerly, for the kind of web app I need, I doesn't help much. I won't load a 10+ Mo blob of cryptic javascript to share some links and stuff on the Internet. Mozilla claim they run 3D FPS in Firefox with it? With which kind of hardware exactly? My 2 year old top tier desktop computer crashed after 10min of loading.

That said, this is (probably) the way to go in the *long* run, because it keeps the number of libraries to maintain to a minimum. (Even if (computer) people together are not rationale anyway, so it doesn't mean anything).

Another example, I created an app using Pythonium veloce mode, basicaly Javascript with a Python 3 syntax, it is as fast JavaScript can be, but you don't have all the nice things of Python builtins and stdlib, getting the code faster can only be done by inlining the generated javascript code, which Javascript compiler already do. The app, is a cover flow music player like old-time itunes, a basic media player that said, but the UI part was already too greedy for my computer because of the animated reflection... Long story short, doing the same in Kivy is a 2 hour hack session and it won't suck down electricity from the kitchen refrigerator while still leaving room for optimizations.

Web browsers are not flexible.

Since when did you see a fully animated website (without glitches) since Flash dissappeared?

Immediatly, I think the best solution to get "Kivy" working in the browser would be Pythonium (no, no brython, not current brython at least). Right you can not drop your kivy app at Pythonium and get a (nice) Javascript file to load in your browser, but it is the kind of thing that it's meant to be able to do.

With Pythonium, you will need to glue some things together, and probably hack directly Pythonium, it's not a big codebase anyway, not everything in Python 3 is supported, but it's doable, simpler and more manageable than a pharaonic blob javascript or hand crafted javascript-the-good-parts©.

Translating a Kivy app to run in the browser can be done in so many ways, at different level in the stack, so the "best" would be to deal with it case by case or get together a set of required features. Right now, .kv files and canonical coordinates are a no-go-to-translate-vanilla-kivy-to-javascript-with-pythonium, but it might change.

If you don't believe in the fully translate a language to javascript thing, you might surprised to know that LightTable code editor is written in ClojureScript and runs in WebKit and it's desktop app, same for github's atom.io, without the good part ;)

I can help you to achieve that.

(It can bring good money, see mono, see titanium, see gwt, see blob inc.)

In order to be able to understand fully my ideas, I need to add the following:

The *only* reason why the browser is interesting is because a *lot* of people are doing it, so:

- a lot of buzz
- a lot of money
- a lot of tooling
- a lot of documentation

The same thing that happened with PHP, happened to Javascript and browsers.

For instance firebug and the like are very impressive softwares but they also rely a lot on the killer feature of browsers as VM: never fully fail. If there is an error, it's still displays the page, so things are a bit nicer that a generated core dump or blue screen of death. The other killer feature is "application streaming" ie. you don't need to download "the full app" to get an idea of what it is - most of the time. I see no other feature, that you can not have with "desktop" applications, better, everything else is easier and better in "desktop" applications (even if not always readily available).

Browsers as UI stack is kind of a toy, you can quickly bootstrap something, but complex things are ugly for ever and for everyone. HTML5 ? Broken. CSS? Broken. Javascript? Broken. The only thing I like that comes out of W3C the DOM API as general API for manipulating & exploring trees, I find it easier than lxml.etree API. jQuery API is nice if you know css selectors. SVG is nice, but Inkscape is way better, I dream of Inkscape-like API in Python (or Javascript :p).

You want to experiement with NUIs and future UI concepts? Forget about the browser.

A lot of people say and think that Web == FOSS. This is fully wrong except from the ground, 20 or 30 years ago when it was created to be some kind of literate computing plateform. It is not anymore since js blobs and hipster grew older. Do you know any end-user kind of distro for the web even as crude as gentoo or name-of-a-distribution-without-package-management that is FOSS that can compute somewhat with fbk, ggl and whatnot? The only software that looks like something like that is MediaGoblin from GNU (& CC) and the ruby app that was all the rage a few years back but nobody cares today. Wordpress and Drupal could qualify, if and only if it was written for todays needs (or my need) in Python or Racket.

In my far reaching goal, of creating my super-dupper-socialite-personal-assistant-kind-of-app, I think the web part will be static html and a download link to a (probably) kivy binary.

I like Kivy as I can quickly experiment stuff, while preserving the nice canvas offered by Python, crafting wanna be nice abstractions, APIs, User Interface and ultimatly applications.

Many times, I see Javascript libraries readily available with nice screenshots or demos, it already runs in my browser, so I think «it works, I can do the same»!  Whereas in Python, I pip search something dozen of results none works on my workstation. So broken? Kind of. But the source code is still their, the algorithm is their, you can adapt the thing to work with kivy and whatnot. It's not because your computer make some colored pixels dancing day and night that it's easy to do. Thinking that if it works in my browsers, I can do the same, is like running a binary on windows and saying I will hack the thing. Good luck.

That said, keeping an eye or two on what is done in the browser is very important. A lot of concept I know, I learned in the browser, like reflow/layout optimisation which is similar to the same concept in kivy but also share ideas with opengl context management. Reactive/Declarative/Flow/Model programming is old time thing, but back in the show thanks to so many people looking for "ways" to do GUI stuff. Learning JavaScript Design Patterns book is inspiring.

In the end, I recognize, I "loose" a lot of time looking for "how to do things" instead of "getting things done" and I forget completly how to start small, taking back the «white-belt», in particular with Kivy.

Best regards,


Amirouche

サムエル テイェイラ サントス

unread,
May 20, 2014, 8:27:21 PM5/20/14
to kivy-...@googlegroups.com
Well...

I also wish to know how this feature is.

It's the last platform to be achieved by Kivy :D

I hope to see it soon
Reply all
Reply to author
Forward
0 new messages