Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x 带导航抽屉的kivy屏幕上未显示标签_Python 3.x_Kivy_Kivy Language - Fatal编程技术网

Python 3.x 带导航抽屉的kivy屏幕上未显示标签

Python 3.x 带导航抽屉的kivy屏幕上未显示标签,python-3.x,kivy,kivy-language,Python 3.x,Kivy,Kivy Language,在这里,我尝试构建一个具有导航栏的应用程序。当我单击这些项目时,导航栏有一个LineListItem,屏幕会发生变化,但标签不会出现。我还尝试在布局中添加多个按钮,效果很好。但当我添加标签时,它不会显示 以下是我使用的kv语言代码:- #:import FadeTransition kivy.uix.screenmanager.FadeTransition # Menu item in the DrawerList list. <ItemDrawer>: theme_text

在这里,我尝试构建一个具有导航栏的应用程序。当我单击这些项目时,导航栏有一个LineListItem,屏幕会发生变化,但标签不会出现。我还尝试在布局中添加多个按钮,效果很好。但当我添加标签时,它不会显示

以下是我使用的kv语言代码:-

#:import FadeTransition kivy.uix.screenmanager.FadeTransition
# Menu item in the DrawerList list.
<ItemDrawer>:
    theme_text_color: "Custom"
    on_release: self.parent.set_color_item(self)

IconLeftWidget:
    id: icon
    icon: root.icon
    theme_text_color: "Custom"
    text_color: root.text_color


<ContentNavigationDrawer>:
    orientation: "vertical"
    padding: "8dp"
    spacing: "8dp"

AnchorLayout:
    anchor_x: "left"
    size_hint_y: None
    height: avatar.height

    Image:
        id: avatar
        size_hint: None, None
        size: "56dp", "56dp"
        source: "data/logo/kivy-icon-256.png"

MDLabel:
    text: "Voice Cloning Tool"
    font_style: "Button"
    size_hint_y: None
    height: self.texture_size[1]

MDLabel:
    text: "MENU"
    font_style: "Caption"
    size_hint_y: None
    height: self.texture_size[1]

ScrollView:

    DrawerList:
        OneLineListItem:
            text:'Home'
            on_release:app.root.current='home_screen'

        OneLineListItem:
            text:'Record Voice'
            on_release:app.root.current='rec_screen'
        OneLineListItem:

            text:'Help'
        OneLineListItem:

            text:'About'
        OneLineListItem:
            text:'Contact Us'
ScreenManagement:
    transition:FadeTransition()
    HomeScreen:
    RecordScreen:
    AboutScreen:
    ContactUSScreen:

<HomeScreen>:
    name:'home_screen'

    NavigationLayout:

        ScreenManager:

            Screen:
                SliderWin

                BoxLayout:
                    orientation: 'vertical'

                    MDToolbar:
                        title: "Explore Voice cloning Tool"
                        elevation: 10
                        left_action_items: [['menu', lambda x: nav_drawer.toggle_nav_drawer()]]

                    Widget:




    MDNavigationDrawer:
            id: nav_drawer

            ContentNavigationDrawer:
                id: content_drawer

<RecordScreen>:
    name:'rec_screen'

    NavigationLayout:

        ScreenManager:

            Screen:


                BoxLayout:
                    orientation: 'vertical'

                    MDToolbar:
                        title: "Explore Voice cloning Tool"
                        elevation: 10
                        left_action_items: [['menu', lambda x: nav_drawer.toggle_nav_drawer()]]
                    Button:
                        text:'Hello World'
                        size_hint:0.5,0.1
                        pos_hint:{'x':0.5,'y':0.5}
                    Button:
                        text:'Hello World'
                        size_hint:0.5,0.1
                        pos_hint:{'x':0.5,'y':0.5}



        MDNavigationDrawer:
            id: nav_drawer

            ContentNavigationDrawer:
                id: content_drawer
#:导入FadeTransition kivy.uix.screenmanager.FadeTransition
#抽屉列表中的菜单项。
:
主题\文本\颜色:“自定义”
发布时:self.parent.set\u color\u项目(self)
IconLeftWidget:
id:图标
图标:root.icon
主题\文本\颜色:“自定义”
文本颜色:root.text\u颜色
:
方向:“垂直”
填充:“8dp”
间距:“8dp”
主持人安排:
锚x:“左”
尺寸提示:无
高度:化身高度
图片:
id:avatar
大小提示:无,无
尺寸:“56dp”,“56dp”
资料来源:“data/logo/kivy-icon-256.png”
MDLabel:
文字:“语音克隆工具”
字体样式:“按钮”
尺寸提示:无
高度:自身纹理大小[1]
MDLabel:
文本:“菜单”
字体样式:“标题”
尺寸提示:无
高度:自身纹理大小[1]
滚动视图:
抽屉列表:
OneLineListItem:
正文:“主页”
发布时:app.root.current='home\u screen'
OneLineListItem:
文字:“录制语音”
发布时:app.root.current='rec\u screen'
OneLineListItem:
文本:“帮助”
OneLineListItem:
正文:“关于”
OneLineListItem:
文字:'联系我们'
屏幕管理:
转换:FadeTransition()
主屏幕:
记录屏幕:
关于屏幕:
联系人屏幕:
:
名称:“主屏幕”
导航布局:
屏幕管理器:
屏幕:
滑块
盒子布局:
方向:“垂直”
MDToolbar:
标题:“探索语音克隆工具”
标高:10
左[操作]项:[[“菜单”,lambda x:nav_抽屉。切换[导航抽屉()]]
小装置:
MDNavigationDrawer:
id:nav_抽屉
ContentNavigationDrawer:
id:content\u抽屉
:
名称:'rec_screen'
导航布局:
屏幕管理器:
屏幕:
盒子布局:
方向:“垂直”
MDToolbar:
标题:“探索语音克隆工具”
标高:10
左[操作]项:[[“菜单”,lambda x:nav_抽屉。切换[导航抽屉()]]
按钮:
文字:“你好,世界”
尺寸提示:0.5,0.1
位置提示:{'x':0.5,'y':0.5}
按钮:
文字:“你好,世界”
尺寸提示:0.5,0.1
位置提示:{'x':0.5,'y':0.5}
MDNavigationDrawer:
id:nav_抽屉
ContentNavigationDrawer:
id:content\u抽屉

我在这里是个白痴。我忘记了默认情况下标签是白色的。这里我的背景也是白色的,这就是它没有被显示的原因。 我将标签的颜色更改为其他颜色并显示出来。下面是更改的代码:-

#:import FadeTransition kivy.uix.screenmanager.FadeTransition
# Menu item in the DrawerList list.
<ItemDrawer>:
    theme_text_color: "Custom"
    on_release: self.parent.set_color_item(self)

    IconLeftWidget:
        id: icon
        icon: root.icon
        theme_text_color: "Custom"
        text_color: root.text_color


<ContentNavigationDrawer>:
    orientation: "vertical"
    padding: "8dp"
    spacing: "8dp"

    AnchorLayout:
        anchor_x: "left"
        size_hint_y: None
        height: avatar.height

        Image:
            id: avatar
            size_hint: None, None
            size: "56dp", "56dp"
            source: "data/logo/kivy-icon-256.png"

    MDLabel:
        text: "Voice Cloning Tool"
        font_style: "Button"
        size_hint_y: None
        height: self.texture_size[1]

    MDLabel:
        text: "MENU"
        font_style: "Caption"
        size_hint_y: None
        height: self.texture_size[1]

    ScrollView:

        DrawerList:
            OneLineListItem:
                text:'Home'
                on_release:app.root.current='home_screen'

            OneLineListItem:
                text:'Record Voice'
                on_release:app.root.current='rec_screen'
            OneLineListItem:

                text:'Help'
            OneLineListItem:

                text:'About'
            OneLineListItem:
                text:'Contact Us'
ScreenManagement:
    transition:FadeTransition()
    HomeScreen:
    RecordScreen:
    AboutScreen:
    ContactUSScreen:

<HomeScreen>:
    name:'home_screen'

    NavigationLayout:

        ScreenManager:

            Screen:
                SliderWin

                BoxLayout:
                    orientation: 'vertical'

                    MDToolbar:
                        title: "Explore Voice cloning Tool"
                        elevation: 10
                        left_action_items: [['menu', lambda x: nav_drawer.toggle_nav_drawer()]]

                    Widget:


        MDNavigationDrawer:
            id: nav_drawer

            ContentNavigationDrawer:
                id: content_drawer

<RecordScreen>:
    name:'rec_screen'

    NavigationLayout:

        ScreenManager:

            Screen:



                BoxLayout:

                    orientation: 'vertical'

                    MDToolbar:
                        title: "Explore Voice cloning Tool"
                        elevation: 10
                        left_action_items: [['menu', lambda x: nav_drawer.toggle_nav_drawer()]]
                    Label:

                        text:'Hello World'
                        size_hint:0.5,0.1
                        pos_hint:{'x':0.5,'y':0.5}
                        color:1,0,1,1

                    Button:
                        text:'Hello World'
                        size_hint:0.5,0.1
                        pos_hint:{'x':0.5,'y':0.5}



        MDNavigationDrawer:
            id: nav_drawer

            ContentNavigationDrawer:
                id: content_drawer
#:导入FadeTransition kivy.uix.screenmanager.FadeTransition
#抽屉列表中的菜单项。
:
主题\文本\颜色:“自定义”
发布时:self.parent.set\u color\u项目(self)
IconLeftWidget:
id:图标
图标:root.icon
主题\文本\颜色:“自定义”
文本颜色:root.text\u颜色
:
方向:“垂直”
填充:“8dp”
间距:“8dp”
主持人安排:
锚x:“左”
尺寸提示:无
高度:化身高度
图片:
id:avatar
大小提示:无,无
尺寸:“56dp”,“56dp”
资料来源:“data/logo/kivy-icon-256.png”
MDLabel:
文字:“语音克隆工具”
字体样式:“按钮”
尺寸提示:无
高度:自身纹理大小[1]
MDLabel:
文本:“菜单”
字体样式:“标题”
尺寸提示:无
高度:自身纹理大小[1]
滚动视图:
抽屉列表:
OneLineListItem:
正文:“主页”
发布时:app.root.current='home\u screen'
OneLineListItem:
文字:“录制语音”
发布时:app.root.current='rec\u screen'
OneLineListItem:
文本:“帮助”
OneLineListItem:
正文:“关于”
OneLineListItem:
文字:'联系我们'
屏幕管理:
转换:FadeTransition()
主屏幕:
记录屏幕:
关于屏幕:
联系人屏幕:
:
名称:“主屏幕”
导航布局:
屏幕管理器:
屏幕:
滑块
盒子布局:
方向:“垂直”
MDToolbar:
标题:“探索语音克隆工具”
标高:10
左[操作]项:[[“菜单”,lambda x:nav_抽屉。切换[导航抽屉()]]
小装置:
MDNavigationDrawer:
id:nav_抽屉
ContentNavigationDrawer:
id:content\u抽屉
:
名称:'rec_screen'
导航布局:
屏幕管理器:
屏幕:
盒子布局:
方向:“垂直”
MDToolbar:
标题:“探索语音克隆工具”
标高:10
左[操作]项:[[“菜单”,lambda x:nav_抽屉。切换[导航抽屉()]]
标签:
文字:“你好,世界”
尺寸提示:0.5,0.1
位置提示:{'x':0.5,'y':0.5}