I don't understand why I have this type of error when I run my code. I've checked this several times and everything seems to be good, still the code does not want to run.
Here's my __main__.py
file :
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.anchorlayout import AnchorLayout
from kivy.properties import ObjectProperty # at top of file
class AccountDetailsForm(AnchorLayout):
server_box = ObjectProperty()
username_box = ObjectProperty()
password_box = ObjectProperty()
def login(self):
print(self.server_box.text)
print(self.username_box.text)
print(self.password_box.text)
class Orkiv(App):
pass
Orkiv().run()
And here's my orkiv.kv
file :
AccountDetailsForm:
<AccountDetailsForm>:
anchor_y: "top"
server_box: server_input
username_box: username_input
password_box: password_input
BoxLayout:
orientation: "vertical"
height: "200dp"
size_hint_y: None
GridLayout:
cols: 2
row_default_height: "40dp"
row_force_default: True
spacing: "10dp"
padding: "10dp"
Label:
text: "Server" //THE ERROR SEEMS TO HAPPEN HERE
AccountDetailsTextInput:
id: server_input
Label:
text: "Username"
AccountDetailsTextInput:
id: username_input
Label:
text: "Password"
AccountDetailsTextInput:
password: True
id: password_input
Button:
size_hint_y: None
height: "40dp"
text: "Login"
on_press: root.login()
Any ideas ? Thanks.
In your orkiv.kv
file, change AccountDetailsTextInput
to just TextInput
.
AccountDetailsForm:
<AccountDetailsForm>:
anchor_y: "top"
server_box: server_input
username_box: username_input
password_box: password_input
BoxLayout:
orientation: "vertical"
height: "200dp"
size_hint_y: None
GridLayout:
cols: 2
row_default_height: "40dp"
row_force_default: True
spacing: "10dp"
padding: "10dp"
Label:
text: "Server"
TextInput:
id: server_input
Label:
text: "Username"
TextInput:
id: username_input
Label:
text: "Password"
TextInput:
password: True
id: password_input
Button:
size_hint_y: None
height: "40dp"
text: "Login"
on_press: root.login()
The app should run. See my output below.
Let us know if this helps.