When I click the button "log in" I want it to see if the password is equal to "ump" in this case. I also want another log in for "admin" but I didn't include that in the if statement.
Here is my main.py:
from cProfile import label
from codecs import BOM_BE
from kivy.lang import Builder
from kivymd.app import MDApp
from kivy.uix.screenmanager import ScreenManager
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.gridlayout import GridLayout
from kivy.uix.textinput import TextInput
from kivy.uix.button import Button
from kivymd.uix.screen import Screen
from rsa import sign
umpirepassword = "ump"
adminpassword = "admin"
class FallsTrackerApp(MDApp):
def build(self):
#set theme style to dark ['Light', 'Dark']
self.theme_cls.theme_style = "Dark"
#set 2nd theme to teal
#['Red', 'Pink', 'Purple', 'DeepPurple', 'Indigo', 'Blue', 'LightBlue', 'Cyan', 'Teal', 'Green', 'LightGreen', 'Lime', 'Yellow', 'Amber', 'Orange', 'DeepOrange', 'Brown', 'Gray', 'BlueGray']
self.theme_cls.primary_palette = "LightBlue"
self.theme_cls.accent_palette = "LightBlue"
return Builder.load_file('bottombar.kv')
def logger(self):
if self.root.ids.sign_in_password.text == umpirepassword:
return Builder.load_file('umpire.kv')
else:
pass
def clear(self):
self.root.ids.sign_in_password.text = ""
FallsTrackerApp().run()
Here is my bottombar.kv:
BoxLayout:
orientation: 'vertical'
MDToolbar:
title: "bottom navbar"
#Navigation Bar
MDBottomNavigation:
#game list
MDBottomNavigationItem:
name: 'game list screen'
text: "Games"
MDLabel:
text: "Games"
halign: 'center'
#sign in screen
MDBottomNavigationItem:
name: 'sign in screen'
text: "Umpire Sign In"
MDLabel:
text: " Welcome!"
font_size: 40
halign: 'center'
size_hint_y: 1.8
MDLabel:
text: "Enter Password Below:"
font_size: 40
halign: 'center'
size_hint_y: 1.5
MDTextFieldRound:
id: sign_in_password
required: True
password: True
password_mask: "●"
hint_text: "Enter Password"
text_color: 'black'
pos_hint: {"center_x": 0.5, "center_y": 0.55}
size_hint_x: 0.75
size_hint_y: 0.1
MDRoundFlatButton:
text:'Log In'
size_hint: .6,.1
pos_hint: {"center_x": 0.5, "center_y": 0.35}
on_press: app.logger()
MDRoundFlatButton:
text:'Clear'
size_hint: .6,.1
pos_hint: {"center_x": 0.5, "center_y": 0.2}
on_press: app.clear()
I currently just have this is my umpire.kv:
MDLabel:
text: "Hello Umpire!"
Just to clarify, when I click the log in button, I want to see if the password in the text input is equal to the umpire password, "ump" or the admin password, "admin". I have included all of my code so if you put it into a code editor you will get exactly what I am getting.
All that I need is the if statement to check the password. I have been looking all over for the function for this but haven't found anything.
*Update: It worked when I did a print statement. But why won't the program update to umpire.kv. Should this load umpire.kv when the umpire password is loaded?
def logger(self):
if self.root.ids.sign_in_password.text == umpirepassword:
return Builder.load_file('umpire.kv')
else:
pass
Shouldn't return Builder.load_file('umpire.kv') have the umpire file run? When I did a print statement instead of loading umpire.kv it worked so it is not the if statement that is the problem I believe.
One final thing. Is there a way to wipe the screen and start with a blank canvas again or do they need to be deleted one at a time.