I found this app in youtube and I need to make it work, but it just won´t, I have uninstalled and installed again Kivy (2.0.1) annd KivyMD (2.0.0), I have re-write my code like four times already, even corrected all mistakes in my kv file, but it still won´t work, it opens the app but then it closes itself, I need this ready by monday cause its for my school, please help me.
this is my main.py
#App Deyanira Fermín
from kivymd.app import MDApp
from kivy.lang import Builder
from kivy.uix.screenmanager import ScreenManager
from kivy.core.window import Window
#from kivy.uix.screenmanager import SwapTransition
import requests
Window.keyboard_anim_args = {'d': .2, 't': 'in_out_expo'}
Window.softinput_mode = "below_target"
class Ui(ScreenManager):
pass
class MainApp(MDApp):
def build(self):
self.theme_cls.theme_stylem = "Dark"
self.theme_cls.primary_palette = "Pink"
Builder.load_file('style.kv')
self.url = 'https://data-fusion-18ed3-default-rtdb.firebaseio.com/.json'
self.key = '0KD3CDLr9DULS9gbcHEpyKmE5rwBkJ9mgAYdxQ9p'
return Ui()
def login_data(self):
userx = self.root.ids.user.text
passwordx = self.root.ids.password.text
state = False
data = requests.get(self.url + '?auth=' + self.key)
for key, value in data.json().items(): #
user_reg = value ['User']
password_reg = value ['Password']
if userx == user_reg:
if passwordx == password_reg:
state = True
self.root.ids.signal_login.text = ''
self.root.ids.user.text = ''
self.root.ids.password.text = ''
else:
self.root.ids.signal_login.text = 'Contraseña incorrecta'
self.root.ids.user.texxt = ''
self.root.ids.password.text = ''
else:
self.root.ids.signal_login.text = 'Usuario Incorrecto'
self.root.ids.user.text = ''
self.root.ids.password.text = ''
return state
def register_data(self):
state = 'datos incorrectos'
userx = self.root.ids.new_user.text
password_one = self.root.ids.new_password_one.text
password_two = self.root.ids.new_password_two.text
data = requests.get(self.url + '?autch=' + self.key)
if password_one != password_two:
state = 'No coinciden las contraseñas'
elif len (userx) <= 4:
state = 'Nombre muy corto'
elif password_one == password_two and len (password_two)<= 4:
state = 'La contraseña es muy corta'
else:
for key, value in data.json().items():
user = value['User']
if user ==userx:
state = 'Este usuario ya existe'
break
else:
state = 'Registrado Correctamente'
data = {userx:{
'User': userx,
'Password': password_one}
}
requests.patch(url = self.url, json = data)
self.root.ids.signal_register.text = 'Registrado Correctamente'
self.root.ids.signal_register.text = state
self.root.ids.new_user.text = ''
self.root.ids.new_password_one.text = ''
self.root.ids.new_password_two.text = ''
return state
def clear_signal(self):
self.root.ids.signal_register.text = ''
self.root.ids.signal_login.text = ''
if __name__=="__main__":
MainApp().run()
and this is my .kv file (style.kv)
#:import SwapTransition kivy.uix.screenmanager.SwapTransition
<Ui>:
transition: SwapTransition() #
MDScreen:
name: 'login'
md_bg_color: 0,0,0,1
MDBoxLayout:
orientation: 'vertical'
spacing:dp(12)
padding: dp(12)
MDBoxLayout:
orientation: 'vertical'
size_hint_y: 0.3
Image:
source: 'logo.png'
pos_hint: {'center_x': 0.5}
MDLabel:
text: 'Iniciar Sesión'
halign: 'center'
color: '#ea899a'
font_size:dp(28)
bold: True
pos_hint: {'center_y': .5}
MDBoxLayout:
orientation: 'vertical'
size_hint_y: 0.3
spacing: dp(12)
MDTextField:
id: user
hint_text: "Nombre de Usuario"
icon_right: "account"
font_size: dp(20)
icon_right_color: '#FF1EB0'
pos_hint: {'center_x': 0.5}
MDTextField:
id: password
password: True
icon_right: "key_variant"
icon_right_color: '#FF1EB0'
hint_text: "Contraseña"
font_size:dp(20)
pos_hint: {'center_x': 0.5}
MDLabel:
id: signal_login
text: '' # 'Datos Incorrectos'
haling: 'center'
color: '##FF1EB0'
font_size:dp(15)
MDBoxLayout:
orientation: 'vertical'
size_hint_y:0.4
spacing: dp(15)
MDFillRoundFlatButton:
id: bt_ingresar
text: 'Ingresar'
pos_hint: {'center_x':0.5}
on_release:
x = app.login_data()
root.current = 'open_screen' if x == True else None
MDFillRoundFlatButton:
md_bg_color:'#000000'
text_color: 255/255, 90/255, 30/255,1
text: 'Crear cuenta'
font_size:dp(20)
pos_hint: {'center_x':0.5}
on_release: root.current = 'screen_register'
#Screen ###############
MDScreen:
name: 'open_screen'
md_bg_color: 255/255, 90/255, 30/255,1
MDBoxLayout:
orientation: 'vertical'
padding: dp(12)
spacing: dp(12)
MDFloatingActionButton:
icon: 'arrow-left'
color_icon: '#000000'
on_release: root.current = 'login'
#Screen - registrarse ########
MDScreen:
name: 'screen:register'
md_bg_color: 0,0,0,1
MDBoxLayout:
orientation: 'vertical'
padding: dp(12)
spacing:12
MDBoxLayout
orientation: 'horizontal'
size_hint: 1, 0.2
MDFloatingActionButton:
icon: 'arroz-left'
pos_hint: {'center_y':.5}
on_release:
root.current = 'login'
app.clear_signal()
MDLabel:
text: 'Crear cuenta'
haling: 'center'
color: '#EA899B'
font_size:dp(28)
bold: True
pos_hint: {'center_y':.5}
MDBoxLayout:
orientation: 'vertical'
size_hint: 1, 0.7
MDLabel:
text: 'Nombre de usuario'
halign: 'center'
color: '#EA899B'
font_size:dp(20)
MDTextField:
id: new_user
hint_text: "Usuario"
icon_right: 'account'
font_size:dp(20)
icon_right_color: '#EA899B'
pos_hint: {'center_x': 0.5}
MDLabel:
text: 'Ingrese su contraseña'
halign: 'center'
color: '#EA899B'
font_size:dp(20)
MDTextField:
id: new_password
password: True
icon_right:"key-variant"
icon_right_color: '#EA899B'
hint_text: "Contraseña"
font_size: dp(20)
pos_hint: {'center_x': 0.5}
MDLabel:
text: 'Confirme su contraseña'
halign: 'center'
color: '#EA899B'
font_size:dp(20)
MDTextField:
id: new_password_two
password: True
icon_right: "key-variant"
icon_right_color: '#EA899B'
hint_text: "Contraseña"
font_size: dp(20)
pos_hint: {'center_x': 0.5}
MDBoxLayout:
orientaton: 'vertical'
size_hint: 1, 0.3
MDLabel:
id: signal_register
text: '' #'Registrado Correctamente'
halign: 'center'
color: '#EA899B'
font_size:dp(15)
MDFillRoundFlatButton:
id: bt_register
text: 'Registrarse'
pos_hint: {'center_x':0.5, 'y':0.5}
on_release: app.register_data()
#
I have tried everything, but I honestly don´t know what I´m doing wrong, I use VS Code and it says this: [INFO ] [Logger ] Record log in C:Usersdfermin.kivylogskivy_24-06-27_15.txt
[INFO ] [deps ] Successfully imported "kivy_deps.gstreamer" 0.3.3
[INFO ] [deps ] Successfully imported "kivy_deps.angle" 0.4.0
[INFO ] [deps ] Successfully imported "kivy_deps.glew" 0.3.1
[INFO ] [deps ] Successfully imported "kivy_deps.sdl2" 0.7.0
[INFO ] [Kivy ] v2.3.0
[INFO ] [Kivy ] Installed at "C:UsersdferminAppDataLocalProgramsPythonPython312Libsite-packageskivy__init__.py"
[INFO ] [Python ] v3.12.4 (tags/v3.12.4:8e8a4ba, Jun 6 2024, 19:30:16) [MSC v.1940 64 bit (AMD64)]
[INFO ] [Python ] Interpreter at "C:UsersdferminAppDataLocalProgramsPythonPython312python.exe"
[INFO ] [Logger ] Purge log fired. Processing...
[INFO ] [Logger ] Purge finished!
[INFO ] [KivyMD ] 2.0.1.dev0, git-Unknown, 2024-06-26 (installed at "C:UsersdferminAppDataLocalProgramsPythonPython312Libsite-packageskivymd__init__.py")
[INFO ] [Factory ] 195 symbols loaded
[INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_pil (img_ffpyplayer ignored)
[INFO ] [Text ] Provider: sdl2
[INFO ] [Window ] Provider: sdl2
[INFO ] [GL ] Using the "OpenGL" graphics system
[INFO ] [GL ] GLEW initialization succeeded
[INFO ] [GL ] Backend used <glew>
[INFO ] [GL ] OpenGL version <b'4.6.0 - Build 31.0.101.2125'>
[INFO ] [GL ] OpenGL vendor <b'Intel'>
[INFO ] [GL ] OpenGL renderer <b'Intel(R) UHD Graphics 620'>
[INFO ] [GL ] OpenGL parsed version: 4, 6
[INFO ] [GL ] Shading version <b'4.60 - Build 31.0.101.2125'>
[INFO ] [GL ] Texture max size <16384>
[INFO ] [GL ] Texture max units <32>
[INFO ] [Window ] auto add sdl2 input provider
[INFO ] [Window ] virtual keyboard not allowed, single mode, not docked
[INFO ] [Clipboard ] Provider: winctypes
[INFO ] [GL ] NPOT texture support is available
Traceback (most recent call last):
File "c:UsersdferminDownloadsaplicaciónmain.py", line 93, in <module>
MainApp().run()
File "C:UsersdferminAppDataLocalProgramsPythonPython312Libsite-packageskivyapp.py", line 955, in run
self._run_prepare()
File "C:UsersdferminAppDataLocalProgramsPythonPython312Libsite-packageskivymdapp.py", line 142, in _run_prepare
super()._run_prepare()
File "C:UsersdferminAppDataLocalProgramsPythonPython312Libsite-packageskivyapp.py", line 925, in _run_prepare
root = self.build()
^^^^^^^^^^^^
File "c:UsersdferminDownloadsaplicaciónmain.py", line 23, in build
return Ui()
^^^^
File "C:UsersdferminAppDataLocalProgramsPythonPython312Libsite-packageskivyuixscreenmanager.py", line 973, in __init__
super(ScreenManager, self).__init__(**kwargs)
File "C:UsersdferminAppDataLocalProgramsPythonPython312Libsite-packageskivyuixfloatlayout.py", line 65, in __init__
super(FloatLayout, self).__init__(**kwargs)
File "C:UsersdferminAppDataLocalProgramsPythonPython312Libsite-packageskivyuixlayout.py", line 76, in __init__
super(Layout, self).__init__(**kwargs)
File "C:UsersdferminAppDataLocalProgramsPythonPython312Libsite-packageskivyuixwidget.py", line 366, in __init__
self.apply_class_lang_rules(
File "C:UsersdferminAppDataLocalProgramsPythonPython312Libsite-packageskivyuixwidget.py", line 470, in apply_class_lang_rules
Builder.apply(
File "C:UsersdferminAppDataLocalProgramsPythonPython312Libsite-packageskivylangbuilder.py", line 545, in apply
self._apply_rule(
File "C:UsersdferminAppDataLocalProgramsPythonPython312Libsite-packageskivylangbuilder.py", line 667, in _apply_rule
self._apply_rule(
File "C:UsersdferminAppDataLocalProgramsPythonPython312Libsite-packageskivylangbuilder.py", line 667, in _apply_rule
self._apply_rule(
File "C:UsersdferminAppDataLocalProgramsPythonPython312Libsite-packageskivylangbuilder.py", line 667, in _apply_rule
self._apply_rule(
File "C:UsersdferminAppDataLocalProgramsPythonPython312Libsite-packageskivylangbuilder.py", line 625, in _apply_rule
cls = Factory_get(cname)
^^^^^^^^^^^^^^^^^^
File "C:UsersdferminAppDataLocalProgramsPythonPython312Libsite-packageskivyfactory.py", line 147, in __getattr__
raise FactoryException('Unknown class <%s>' % name)
kivy.factory.FactoryException: Unknown class <MDFillRoundFlatButton>
New contributor
Deyanira Fermín is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.