带kivy的可滚动注册屏幕

2024-07-08 03:37:43 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图用kivy构建一个可滚动的注册屏幕,但我得到了这个错误:异常:“ScrollView只接受一个小部件”。拜托,我该怎么解决这个问题?我还可以得到一些关于如何允许用户在签名时上传文件的指导吗?如有其他建议,我们将不胜感激。谢谢

<SignupWindow>:
    first_name: first_name
    middle_name: middle_name
    last_name: last_name
    email2: email2
    password2: password2
    profession: profession
    birth: birth


    ScrollView:
        GridLayout:
            orientation: "vertical"
            size_hint_y: None
            height: self.minimum_height
            row_default_height: 60
            cols:2

            Label:
                text : "First Name: "
                size_hint : 0.2, 0.05
                pos_hint : {"x":0.25, "top":0.9}
            TextInput:
                id : first_name
                hint_text: "First name"
                multiline : False
                size_hint : 0.15, 0.05
                pos_hint : {"x" : 0.45, "top" : 0.9}

            Label:
                text : "Middle Name: "
                size_hint : 0.2, 0.05
                pos_hint : {"x":0.25, "top":0.8}
            TextInput:
                id : middle_name
                hint_text: "Middle name"
                multiline : False
                size_hint : 0.15, 0.05
                pos_hint : {"x" : 0.45, "top" : 0.8}


            Label:
                text : "Last Name: "
                size_hint : 0.2, 0.05
                pos_hint : {"x":0.25, "top":0.7}
            TextInput:
                id : last_name
                hint_text: "Last name"
                multiline : False
                size_hint : 0.15, 0.05
                pos_hint : {"x" : 0.45, "top" : 0.7}

            Label:
                text : "Date of Birth: "
                size_hint : 0.2, 0.05
                pos_hint : {"x":0.25, "top":0.6}
            TextInput:
                id : birth
                hint_text: "mm/dd/yyyy"
                multiline : False
                size_hint : 0.15, 0.05
                pos_hint : {"x" : 0.45, "top" : 0.6}

            Label:
                text : "Email: "
                size_hint : 0.2, 0.05
                pos_hint : {"x" : 0.25, "top" : 0.5}
            TextInput:
                id : email2
                hint_text: "email@domain.com"
                multiline : False
                size_hint : 0.3, 0.05
                pos_hint : {"x" : 0.45, "top" : 0.5}

            Label:
                text : "Password: "
                size_hint : 0.2, 0.05
                pos_hint : {"x" : 0.25, "top" : 0.4}
            TextInput:
                id : password2
                hint_text: "Choose a password"
                multiline : False
                size_hint : 0.3, 0.05
                pos_hint : {"x" : 0.45, "top" : 0.4}

            Label:
                text : "Password: "
                size_hint : 0.2, 0.05
                pos_hint : {"x" : 0.25, "top" : 0.3}
            TextInput:
                hint_text: "Type your password again"
                multiline : False
                size_hint : 0.3, 0.05
                pos_hint : {"x" : 0.45, "top" : 0.3}


            Label:
                text : "Profession: "
                size_hint : 0.2, 0.05
                pos_hint : {"x":0.25, "top":0.2}
            TextInput:
                id : profession
                hint_text: "Profession"
                multiline : False
                size_hint : 0.3, 0.05
                pos_hint : {"x" : 0.45, "top" : 0.2}



        Button:
            text : "Submit"
            size_hint : 0.15, 0.05
            pos_hint : {"x" : 0.75, "top" : 0.1}
            on_press :
                root.signupbtn()
                root.manager.transition.direction = "right"

        Button:
            text : "Login"
            size_hint : 0.15, 0.05
            pos_hint : {"x" : 0.1, "top" : 0.1}
            on_release:
                root.manager.current = 'login'
                root.manager.transition.direction = "up"

热门问题