• <bdo id='hnLFM'></bdo><ul id='hnLFM'></ul>

    1. <i id='hnLFM'><tr id='hnLFM'><dt id='hnLFM'><q id='hnLFM'><span id='hnLFM'><b id='hnLFM'><form id='hnLFM'><ins id='hnLFM'></ins><ul id='hnLFM'></ul><sub id='hnLFM'></sub></form><legend id='hnLFM'></legend><bdo id='hnLFM'><pre id='hnLFM'><center id='hnLFM'></center></pre></bdo></b><th id='hnLFM'></th></span></q></dt></tr></i><div id='hnLFM'><tfoot id='hnLFM'></tfoot><dl id='hnLFM'><fieldset id='hnLFM'></fieldset></dl></div>

        <small id='hnLFM'></small><noframes id='hnLFM'>

        <tfoot id='hnLFM'></tfoot><legend id='hnLFM'><style id='hnLFM'><dir id='hnLFM'><q id='hnLFM'></q></dir></style></legend>

        Python - 在应用程序中显示 Web 浏览器/iframe

        Python - Showing a web browser/iframe right into the app(Python - 在应用程序中显示 Web 浏览器/iframe)
        <i id='fIxsX'><tr id='fIxsX'><dt id='fIxsX'><q id='fIxsX'><span id='fIxsX'><b id='fIxsX'><form id='fIxsX'><ins id='fIxsX'></ins><ul id='fIxsX'></ul><sub id='fIxsX'></sub></form><legend id='fIxsX'></legend><bdo id='fIxsX'><pre id='fIxsX'><center id='fIxsX'></center></pre></bdo></b><th id='fIxsX'></th></span></q></dt></tr></i><div id='fIxsX'><tfoot id='fIxsX'></tfoot><dl id='fIxsX'><fieldset id='fIxsX'></fieldset></dl></div>

                <tbody id='fIxsX'></tbody>

              1. <tfoot id='fIxsX'></tfoot>
                • <bdo id='fIxsX'></bdo><ul id='fIxsX'></ul>

                  <small id='fIxsX'></small><noframes id='fIxsX'>

                  <legend id='fIxsX'><style id='fIxsX'><dir id='fIxsX'><q id='fIxsX'></q></dir></style></legend>
                  本文介绍了Python - 在应用程序中显示 Web 浏览器/iframe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个脚本,如果对人们回答问题有帮助的话,我正在使用 kivy.我想让它在运行时直接显示 iframe 之类的东西,而不是打开浏览器.例如这样的:

                  I have a script which if helpful to people answering questions, is using kivy. I want to have it show a iframe kind of thing right into it when run, instead of opening the browser. For example something like this:

                  def browser():
                      url = "google.com"
                      iframe(url)
                  browser()
                  

                  显然这不起作用,因为 python 不是 html.请记住,我不是想跑步这个脚本在网络上,但在 kivy 启动器上.正如预期的那样,它不应该打开浏览器,而是在脚本内置的框中显示页面.

                  Obviously this wouldnt work as python is not html. Keep in mind, I am not trying to run this script on the web, but on the kivy launcher. As intended, it should not open the webbrowser but instead show the page in a box built right into the script.

                  推荐答案

                  这是一个在Kivy Launcher"应用程序中运行的实际运行示例:

                  Here's an actual running example which works right inside the "Kivy Launcher" app:

                  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.renpy.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()
                  

                  这篇关于Python - 在应用程序中显示 Web 浏览器/iframe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Kivy 1.9.0 Windows package KeyError: #39;rthooks#39;(Kivy 1.9.0 Windows 包 KeyError: rthooks)
                  Python Kivy: how to call a function on button click?(Python Kivy:如何在按钮单击时调用函数?)
                  How to disable a widget in Kivy?(如何禁用 Kivy 中的小部件?)
                  Centering an object in Kivy(在 Kivy 中将对象居中)
                  How to downgrade to Python 3.4 from 3.5(如何从 Python 3.5 降级到 Python 3.4)
                  Change button or label text color in kivy(在kivy中更改按钮或标签文本颜色)
                    <tfoot id='5hpQ5'></tfoot>

                    <i id='5hpQ5'><tr id='5hpQ5'><dt id='5hpQ5'><q id='5hpQ5'><span id='5hpQ5'><b id='5hpQ5'><form id='5hpQ5'><ins id='5hpQ5'></ins><ul id='5hpQ5'></ul><sub id='5hpQ5'></sub></form><legend id='5hpQ5'></legend><bdo id='5hpQ5'><pre id='5hpQ5'><center id='5hpQ5'></center></pre></bdo></b><th id='5hpQ5'></th></span></q></dt></tr></i><div id='5hpQ5'><tfoot id='5hpQ5'></tfoot><dl id='5hpQ5'><fieldset id='5hpQ5'></fieldset></dl></div>
                      • <bdo id='5hpQ5'></bdo><ul id='5hpQ5'></ul>
                      • <legend id='5hpQ5'><style id='5hpQ5'><dir id='5hpQ5'><q id='5hpQ5'></q></dir></style></legend>
                          <tbody id='5hpQ5'></tbody>

                        <small id='5hpQ5'></small><noframes id='5hpQ5'>