Not able to use CefBrowser widget in my app

178 views
Skip to first unread message

satyam yadav

unread,
Jul 1, 2022, 5:15:47 PM7/1/22
to Kivy users support
I am using this  below video as a guide to give a cefbrowser in my app but it seems that dependecies have changed because when i am trying to do the while importing the dependecies it is showing error of the can not find reference:

https://www.youtube.com/watch?v=2xT6YtJ48zQ 

I am importing dependencies through this:

from kivy.garden.cefpython import CefBrowser
from kivy_garden.cefpython import CefBrowser
from kivy.garden.cefpython import CEFBrowser

but the error keeps the same for every dependency

Elliot Garbus

unread,
Jul 1, 2022, 10:13:25 PM7/1/22
to kivy-...@googlegroups.com

If you read the readme in the kivy garden you see…

https://github.com/kivy-garden/garden.cefpython

This is a widget that embed https://code.google.com/p/cefpython into a Kivy widget. Works currently on Linux and Windows 64bit with python 2.7This project shouldn't considered stable. There are major things (ex. popups) which aren't implemented or causing problems.

Looking at the video you share he used a fork located at: https://github.com/allestuetsmerweh/garden.cefpython

Read the release notes, it has only been tested on Linux… this is not stable code or an active project.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/16cf1efa-43c8-4c97-ba87-706b273a3e11n%40googlegroups.com.

 

Robert

unread,
Jul 2, 2022, 1:24:28 AM7/2/22
to Kivy users support
If your target is Android, this has similar functionality https://github.com/Android-for-Python/Webview-Example

satyam yadav

unread,
Jul 2, 2022, 5:06:15 AM7/2/22
to Kivy users support

Okay guys will look into  this android-webview project , but you know the CEFBrowser was exact example for my app, and what's the  feature called when we press on button in app and then a bottomsheet appears for the permission of the browser and when we select any browser then the screen closes the current app and opens the selected app and in that browser or link it opens the link associated with the button we pressed in other app.

How we can achieve this.

Elliot Garbus

unread,
Jul 2, 2022, 8:20:14 AM7/2/22
to kivy-...@googlegroups.com

Are you describing the OS supported file association?  Or perhaps OS permission?

Another alternative for opening a web browser on a desktop os is the use  the python webbrowser module.  This does not embed a browser, but opens a browser window. 

https://docs.python.org/3/library/webbrowser.html

satyam yadav

unread,
Jul 2, 2022, 4:05:22 PM7/2/22
to Kivy users support
I am referring to the thing like sometimes you encounter something the any app and if you click on this you directly get transferred to chrome and the link opens in the browser and your app is in background.

Robert

unread,
Jul 2, 2022, 5:16:25 PM7/2/22
to Kivy users support
If you want to use the device's default browser, see the first and last lines of this file:
The argument on the last line is the url.

Elliot Garbus

unread,
Jul 3, 2022, 12:27:04 AM7/3/22
to kivy-...@googlegroups.com

On a desktop/laptop try https://docs.python.org/3/library/webbrowser.html, it is very easy – build a simple prototype and give it a try.

 

-Elliot

satyam yadav

unread,
Jul 3, 2022, 3:47:21 AM7/3/22
to Kivy users support
okay i am going to use webview on mobile app , i will make one and if it happens well and good if it does not work , i will come back here, till then thank you

satyam yadav

unread,
Jul 3, 2022, 5:30:06 PM7/3/22
to Kivy users support
I tried using webview using the below sample but was not able to download since one of the dependency does not get downloaded.
I used the below code which i found in one of the discussion of the webview.
first of all the jnius dependecy does not get downloaded then the android module does not get downloaded which are giving error of reference not found for the module android and jnius
, i am using pycharm ide 

"""
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')
activity = autoclass('org.kivy.android.PythonActivity').mActivity


class Wv(Widget):
    def __init__(self, **kwargs):
        super(Wv, self).__init__(**kwargs)
        Clock.schedule_once(self.create_webview, 0)

    @run_on_ui_thread
    def create_webview(self, *args):
        webview = WebView(activity)
        webview.getSettings().setJavaScriptEnabled(True)
        wvc = WebViewClient();
        webview.setWebViewClient(wvc);
        activity.setContentView(webview)
        webview.loadUrl('http://www.google.com')


class ServiceApp(App):
    def build(self):
        return Wv()


if __name__ == '__main__':
    ServiceApp().run()

"""
I would request if this code need some change then please correct me and is the code really needs to be changed then please provide a working solution.

Robert

unread,
Jul 3, 2022, 6:36:16 PM7/3/22
to Kivy users support
> dependency does not get downloaded.
Yes, you cant install the android package on a desktop, it interfaces with Android stuff, it has no meaning on a desktop.
jnius I think you can install, but since the Android libraries don't exist you can't import them. So not useful.

The code in your post only works on Android.

And an earlier post points to a working webview example
But again as it says there " An embedded Kivy Android web page viewer"

satyam yadav

unread,
Jul 3, 2022, 6:41:57 PM7/3/22
to Kivy users support
Hi Robert ,  I totally understood what you said but any example does not work , i am not able to figure out how i can  add webview as a widget in my big app.

satyam yadav

unread,
Jul 3, 2022, 6:58:19 PM7/3/22
to Kivy users support
I tried to used embedded native webview but again the android package error
Message has been deleted

Robert

unread,
Jul 3, 2022, 7:53:15 PM7/3/22
to Kivy users support
The error occurs after building an apk?
If yes: please share the logcat.

If no: I see you say that you say you understand, but I wonder if you do.
The android package is not available on a desktop.
If you try to install it on a desktop the install will fail.

satyam yadav

unread,
Jul 3, 2022, 8:09:06 PM7/3/22
to Kivy users support
okay i will try to build the apk and run on a emulator ten will tell you  if any other error occurs or not.

satyam yadav

unread,
Jul 3, 2022, 8:38:49 PM7/3/22
to Kivy users support
and i use google colab to built my apk so lets see
Reply all
Reply to author
Forward
0 new messages