我是Kivy的新手,我有这个小的演示片段来演示我的问题:
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.lang import Builder
class KivyGuiApp(App):
def build(self):
return root_widget
class MyBox(BoxLayout):
def print_ids(self, *args):
print("\nids:")
for widget in self.walk():
print("{} -> {}".format(widget, widget.id))
def print_names(self, *args):
print("\nnames:")
for widget in self.walk():
print("{} -> {}".format(widget, widget.name))
root_widget = Builder.load_string("""
MyBox:
id: screen_manager
name: 'screen_manager'
SimpleLayout:
id: simple_layout
name: 'simple_layout'
<SimpleLayout@BoxLayout>:
id: simple_layout_rule
name: 'simple_layout_rule'
Button:
id: button_ids
name: 'button_ids'
text: 'print ids to console'
on_release: app.root.print_ids()
Button:
id: button_names
name: 'button_names' …Run Code Online (Sandbox Code Playgroud) 我已经按照 Kivy wiki 说明成功地将 WebView 附加到我的 Kivy 应用程序。它按预期工作,但我想断开连接并返回到我正常的 Kivy ui。我该怎么做?
我试图探索 WebView文档,访问它的方法(WebView.destroy()抱怨破坏仍然附加的 WebView),它是父方法(我什至不确定这是否是要走的路),但我不能不要摆脱 WebView。