webbrowser in Kivy

7,278 views
Skip to first unread message

Bronco0

unread,
Jan 18, 2012, 10:15:40 AM1/18/12
to Kivy users support
Hi,

How is it possible to create a web browser with Kivy?
I wanted to try with webkit python but uses Gtk or Qt, not possible to
integrate directly to Kivy.

I tried to use a Qt widget in a widget Kivy, but I have a problem with
the event loop.
Is there a way to disabled the loop and Qt to use than Kivy?

Thank you.

skeezix

unread,
Jan 18, 2012, 10:54:29 AM1/18/12
to Kivy users support
On Wed, 18 Jan 2012, Bronco0 wrote:

# How is it possible to create a web browser with Kivy?
# I wanted to try with webkit python but uses Gtk or Qt, not possible to
# integrate directly to Kivy.
#
# I tried to use a Qt widget in a widget Kivy, but I have a problem with
# the event loop.
# Is there a way to disabled the loop and Qt to use than Kivy?

You can drive the Qt event loop by function calls, if you need to
(ie: if you have multiple frameworks that all want to run the event loop,
only one can really do it, so you have to drive the other manually..)

Are you trying to make a web browser, or just use webkit/etc to
render html to a display, to show a textfile or help box or something?

If its mostly just a display thing, you might be able to get away
with trying to render webkit to a framebuffer (or even to a texture and
then apply the texture in kivy?) ie: Like some of the video players work
.. use a widget in the toolkit (kivy in this case) and then find the
widget location and dimensions, then direct the webkit renderer to render
to framebuffer at that location/size; make it look like its in the UI, but
the UI is only aware of an empty box there.. that sort of trickery.

jeff

--
If everyone would put barbecue sauce on their food, there would be no war.

Mathieu Virbel

unread,
Jan 18, 2012, 12:24:58 PM1/18/12
to kivy-...@googlegroups.com
Hi,

It's actually possible, but working right now only on linux 64bits.

https://github.com/kivy/kivy-berkelium
Download the extension from https://github.com/kivy/kivy-berkelium/downloads

We have done an initial wrapper around berkelium.org project, even if
it's works mostly, it's linux only. Anybody wanna help / update the
project on the latest berkelium version is welcome !

Otherwise, you can use other toolkit (gtk, qt), but the main issue is
not to drive the main loop of both framework (that's the simple part),
the complex part is to be able to do the rendering of the framework in a
pixmap, put it in a texture, and use the texture for a Rectangle
instruction.

Mathieu

Danieru Karpuk

unread,
Mar 5, 2013, 7:21:01 AM3/5/13
to kivy-...@googlegroups.com
Hello lads!
I would like to ask about how is the work about porting webkit to kivy going? I picked an engineer project that requires multi-touch framework and a web rendering engine. Basically it would be a website editor/creator for a touchscreen devices. As a framework i picked Kivy for its simplicity. Now I would need an HTML rendering engine for it to work. Of course if there is another relatively simple framework with multi-touch support and a rendering engine that works with it, I'd be happy to change my used technologies. Also I could help to contribute with any rendering engine for Kivy, by supporting the team (of course I'm a not bad programmer).
Cheers,
Dracco

SongHua Liu

unread,
Dec 9, 2013, 8:38:02 PM12/9/13
to kivy-...@googlegroups.com, dra...@gmail.com
So is the web rendering engine thing solved?
I am also looking for a functionality as what Dracco said. Let's improve it. :)

在 2013年3月5日星期二UTC+8下午8时21分01秒,Danieru Karpuk写道:

qua-non non

unread,
Dec 11, 2013, 4:18:52 AM12/11/13
to kivy-...@googlegroups.com


--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

knappador

unread,
Dec 12, 2013, 10:08:09 AM12/12/13
to kivy-...@googlegroups.com
On Android at least, a possible alternative but less platform independent way is to use web-views.  We're in the process of figuring out which Android widgets "just work."  There is plenty of support in pyjnius for making the API calls to Android.  There might be some code out there for showing a Maps widget.  Not sure what status is.

Michael Hines

unread,
Jun 10, 2014, 3:41:04 AM6/10/14
to kivy-...@googlegroups.com
This guy posted an example of using a native webview, but I can't get it to work.

https://groups.google.com/forum/#!topic/kivy-users/9sH0y3KxCuU

He defines a simple widget that creates a webview. How do you load native widgets after they are created in pyjnius?

Ideas?

Ahmad Alobaid

unread,
Jul 10, 2014, 10:08:01 AM7/10/14
to kivy-...@googlegroups.com


1-copy the code to lets say we.py
2-import Webview to your main.py as a Widget, but note that it will take the whole screen (I tried to resize it with no luck)



I do not remember where did I got this code from, 

##in we.py

## Summary

#* *author: Micheal Hines*
#* *kivy: >= 1.8*

#Python code for creating a native Android "webview" inside of a Kivy app.

## Files

#### main.py

import kivy    
from kivy.app import App    
from kivy.lang import Builder    
from kivy.utils import platform    
from kivy.uix.widget import Widget    
from kivy.clock import Clock    
from jnius import autoclass    
from android.runnable import run_on_ui_thread    
    
WebView = autoclass('android.webkit.WebView')    
WebViewClient = autoclass('android.webkit.WebViewClient')    
#WebChromeClient = autoclass('android.webkit.WebChromeClient')                                       
activity = autoclass('org.renpy.android.PythonActivity').mActivity    
    
class Webview(Widget):    
    def __init__(self, **kwargs):    
        super(Webview, self).__init__(**kwargs)    
        Clock.schedule_once(self.create_webview, 0)                                                 
        #Clock.schedule_once(self.create_webview,  1./60)                                             
    
    @run_on_ui_thread    
    def create_webview(self, *args):    
        webview = WebView(activity)    
        webview.getSettings().setJavaScriptEnabled(True)    
        wvc = WebViewClient();    
        webview.setWebViewClient(wvc);    
        #wvcr = WebChromeClient();
        #webview.setWebChromeClient(wvcr)
        activity.setContentView(webview)
        webview.loadUrl('http://www.google.com')

Bhavesh Anand

unread,
Feb 1, 2017, 8:31:02 AM2/1/17
to Kivy users support
Hi,

Is there any other library by using which Browser can be developed on Kivy.
How about pywebview .

me2 beats

unread,
Nov 2, 2018, 2:33:24 AM11/2/18
to Kivy users support
hi guys, is there any progress in this?

Can you give me pls an advice on how to make kivy to display a window with a specific web page?
 

Boca Valentin

unread,
Nov 5, 2018, 4:52:16 PM11/5/18
to kivy-...@googlegroups.com
Hi!
import webbrowser
....
webbrowser.open_new_tab( web_page_link )

On Fri, Nov 2, 2018 at 8:33 AM me2 beats <prod.m...@gmail.com> wrote:
hi guys, is there any progress in this?

Can you give me pls an advice on how to make kivy to display a window with a specific web page?
 

--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.

me2 beats

unread,
Nov 5, 2018, 5:26:45 PM11/5/18
to Kivy users support
I mean I want to use Kivy as a web browser.
if I understand correctly, your example simply opens a web page in the default browser (for example, Google Chrome).

I have already found a solution - cefpython, it works, at least on ubuntu.

вторник, 6 ноября 2018 г., 2:52:16 UTC+5 пользователь Boca Valentin написал:

Boca Valentin

unread,
Nov 10, 2018, 3:21:35 AM11/10/18
to kivy-...@googlegroups.com
Ok, now i understand what were you after. I had no idea of CefPython, thanks!

Reply all
Reply to author
Forward
0 new messages