TextInput State

this is my python file content i made a mysql data base and connected it to the program and i have a problem with the home screen because i am trying to make a search bar

from kivy.app import App
import mysql.connector
from arabic_reshaper import reshape
from bidi.algorithm import get_display
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.label import Label
from kivy.uix.textinput import TextInput
from kivy.uix.widget import Widget
from kivy.graphics import Rectangle, Color
from kivy.core.window import Window
from kivy.uix.button import Button
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.properties import StringProperty
sm=ScreenManager()
mydb = mysql.connector.connect(
    host="localhost",
    user="root",
    password="A.C.A_2024",
    database="users_data"
)
my_cursor = mydb.cursor()
my_cursor.execute("SELECT * FROM data")
data=my_cursor.fetchall()
def arab(text):
    return get_display(reshape(text))


class LoginPageLayout(Screen):
    error_text=StringProperty("")
    def SignIn(self,username,password):
        print("hello")
        for i in data:
            if i[0] == username and i[1] == password:
                print("hi")
                print(username)
                print(password)
                sm.current="HomePage"
        print("try again")

class SignUpLayout(Screen):
    error_text = StringProperty("")
    def SignUp(self,username,password):
        if len(username)<8:
            self.error_text="user name must be 8 charcters atleast"
        elif len(password)<8:
            self.error_text="password must be 8 characters atleast"
        else:
            print("hello")
            my_cursor.execute("INSERT INTO data (username , password) VALUES (%s , %s)", (username, password))
            mydb.commit()
            print("done excecuting")
            sm.current = "HomePage"
class HomePage(Screen):
    pass






class ACAapp(App):
    def build(self):
        sm.add_widget(LoginPageLayout(name="LoginPageLayout"))
        sm.add_widget(SignUpLayout(name="SignUpLayout"))
        sm.add_widget(HomePage(name="HomePage"))
        return sm


ACAapp().run()

and this is my kivy file

<LoginPageLayout>:

    BoxLayout:
        padding: [50,10,50,30]
        spacing: 20
        orientation: "vertical"
        Label:
            text: "login page"
            font_name: "andlso.ttf"
        TextInput:
            id: user
            multiline: False
        TextInput:
            id: password
            multiline: False
            password: True
        Button:
            font_name: "andlso.ttf"
            text: "login"
            on_press: root.SignIn(user.text , password.text)
        Button:
            font_name: "andlso.ttf"
            text: "don`t have an account? sign up"
            on_press: root.manager.current="SignUpLayout"

<SignUpLayout>
    BoxLayout:
        font_size: 40
        padding: [50,10,50,30]
        spacing: 20
        orientation: "vertical"
        Label:
            text: "sign up page"
            font_name: "andlso.ttf"
        TextInput:
            id: user2
            multiline: False
        TextInput:
            id: pass2
            multiline: False
            password: True
        Label:
            text: root.error_text
            font_name: "andlso.ttf"
        Button:
            text: "sign up"
            on_press: root.SignUp(user2.text,pass2.text)
<HomePage>:
    canvas.before:
        RoundedRectangle:
            pos: 50 , self.height-75
            size: self.width-50 , 50
            radius: [(40,40),(40,40),(40,40),(40,40)]
    TextInput:
        size_hint: (None , None)
        width: root.width-100
        height: 50
        pos: 75 , root.height-75

signup and signin screens are already done and i am working on the home page

i tried to make a search bar in the home screen but the color of the text input when active is diffrent from the color of the rectangle

New contributor

Ziad Elhusiny is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật