|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
用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 |
|