Python, How do I validate login credentials saved in mysql?

I am trying to make a application with (kivy, python and mysql). My script should run and grab the login and password to verify what the user put into the areas. I have done this in PHP but I just can't wrap my head around writing it in python. I am still fairly new to the python language and I am converting from PHP. If the login is correct it will slide to the next screen and say logout, if not it will just wipe the text that was entered. It deletes the text I assume because it can't grab the right info or verify it in the script.

from import App
from import StringProperty
import os
from kivy.uix.screenmanager import ScreenManager, Screen, SlideTransition
from connected import Connected
import pymysql.cursors

conn = pymysql.connect(host='',

class Login(Screen):
    def do_login(self, loginText, passwordText):
        app = App.get_running_app()

        app.username = loginText
        app.password = passwordText
        with conn.cursor() as cursor:
            sql = "SELECT * FROM login WHERE username = %s && password = %s"
            cursor.execute(sql, (app.username, app.password))
            if app.username == cursor.execute and app.password == cursor.execute:
                self.manager.transition = SlideTransition(direction="left")
                self.manager.current = 'connected'


            self.manager.transition = SlideTransition(direction="right")
            self.manager.current = 'login'

    def resetForm(self):
        self.ids['login'].text = ""
        self.ids['password'].text = ""

class LoginApp(App):
    username = StringProperty(None)
    password = StringProperty(None)

    def build(self):
        manager = ScreenManager()


         return manager

    def get_application_config(self):
        if not self.username:
            return super(LoginApp, self).get_application_config()

        conf_directory = self.user_data_dir + '/' + self.username

        if not os.path.exists(conf_directory):

        return super(LoginApp, self).get_application_config(
            '%s/config.cfg' % conf_directory

if __name__ == '__main__':