suede 发表于 2021-2-18 17:47:38

求帮忙看看哪里出错了

用kivy写了一个app的开始和登录(未完成),注册页面,在pycharm上:
在py文件中的代码为:
from kivy.app import App
from kivy.uix.label import Label
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.textinput import TextInput
from kivy.uix.boxlayout import BoxLayout
from kivy.lang import Builder
from kivy.uix.screenmanager import Screen,ScreenManager

class WelcomePage(Screen):
      pass

class LogIn(Screen):
      pass

class Register(Screen):
      pass

class TransitionWindow(ScreenManager):
      pass

kv = Builder.load_file("my.kv")

class MyApp(App):
      def build(self):
                return kv

if __name__ == "__main__":
      MyApp().run()

在my.kv文件中的代码为:
TransitionWindow:
    WelcomePage:
    LogIn:
    Register:

<WelcomePage>:
      orientation:"vertical"

      Label:
                text:"Welcome!"
                text_size:cm(6),mm(28)
                font_size: 40
                italic:True
                color:.8,.2,.1,3

      FloatLayout:
                Button:
                        text:"Log In"
                        size_hint:.2,.15
                        font_size:30
                        pos:185,100
                        background_color:0,1,1,1
                        on_release:app.root.current = "login"
                Button:
                        text:"Register"
                        size_hint:.2,.15
                        font_size:30
                        pos:485,100
                        background_color:0,1,1,1
                        on_release:app.root.current = "register"


<LogIn>:
    name: "login"
    FloatLayout:
      Label:
            text:"Fill the following information to log in"
            font_size: 15
            italic:True
      TextInput:
            text:"account"
            multiline = False
            pos = 300,500
      TextInput:
            text:"password"
            multiline = False
            pos = 300,700

    Button:
      text:"Enter"
      on_release: app.root.current = "register"

<Register>:
    name: "register"
    FloatLayout:
      Label:
            text:"Fill the following information to log in"
            font_size: 15
            italic:True
      TextInput:
            text:"account"
            multiline = False
            pos = 300,500
      TextInput:
            text:"password"
            multiline = False
            pos = 300,700

    Button:
      text:"Enter"
      on_release:app.root.current = "login"

运行报错:
if current_property[:3] == 'on_':
TypeError: 'NoneType' object is not subscriptable

suede 发表于 2021-2-18 17:49:53

说是类型错误,实在没有找出错哪了
页: [1]
查看完整版本: 求帮忙看看哪里出错了