python - Find an object in a library (here, it is the NavigationLayout of the Kivy library)
问题描述
I am learning Kivy and I'm not used to .kv
, so I am trying to learn the "hard way" first.
Problem: there is not a lot of documentation for interaction with Kivy except .kv
.
I'm stuck with the import of the NavigationLayout, I tried to find it on the official Github, but I failed !
from kivy.uix.boxlayout import BoxLayout
from kivymd.uix.toolbar import MDToolbar
from kivy.properties import ObjectProperty
from kivy.uix.screenmanager import ScreenManager, Screen
from kivymd.app import MDApp
#from kivy import road.to.navigationlayout import NavigationLayout
class App(MDApp):
def build(self):
screen_manager = ScreenManager()
main_screen = Screen()
main_box = BoxLayout()
main_toolbar = MDToolbar()
main_toolbar.title = "Hello there !"
#navigation_layout = NavigationLayout()
screen_manager.add_widget(main_screen)
main_screen.add_widget(main_box)
main_box.add_widget(main_toolbar)
return screen_manager
App().run()
PS: If you have tips to find out where objects are situated in new libraries, I would be happy to heard them!
解决方案
它在 MDKivy 库中。(我在另一个堆栈溢出帖子中找到了它)
from kivymd.uix.navigationdrawer import NavigationLayout
推荐阅读
- javascript - 我正在返回渲染,但问题仍然存在
- django - 我需要访问一个外键元素来填充 ModelForm
- sling - 如何在 Composum 平台上公开网站
- c++ - Poco 的 Path current() 没有返回 C++ 中的当前工作目录
- quarkus - 如何发布基于表单的身份验证
- java - 我如何在 android 中具有 xy 位置的图像上制作可移动的 perticuler 点?
- java - 在方法中初始化局部变量
- spring-boot - Openshift 容器运行状况探测连接被拒绝
- ubuntu - 通过SSH,Ubuntu 20.04(Focal)“无法获得引用控制台的文件描述符”
- python - 从数据框 pandas 创建 groupby 函数