Python KivyMD: how to call a function using a button? - python

im new to kivy and kivyMD, and i was trying to call a function that would print the email and password of a user. how would can i bind the function or use on_press in this code?
i tried using on_pressed:root.function() method, but it doesnt work since my function is not written in the pr-emade ScreenManager
.PY
import...
Builder.load_string("""
#:include kv/login.kv
#:import utils kivy.utils
#:import images_path kivymd.images_path
""")
class MyApp(MDApp):
def __init__(self, **kwargs):
self.title = "iKarate"
self.theme_cls.theme_style = "Light"
self.theme_cls.primary_palette = "Blue"
self.sm = ScreenManager()
super().__init__(**kwargs)
def build(self):
self.sm.add_widget(Factory.LoginScreen())
return self.sm
def doThis(self):
email = self.email
password = self.password
print(email, password)
if __name__ == "__main__":
MyApp().run()
.KV
#:kivy 1.11.1
<LoginScreen#Screen>:
name: "login"
BackgroundLayer:
#MDCard:
MDCard:
orientation: "vertical"
size_hint: [0.8, 0.6]
pos_hint: {"center_x": 0.5, "center_y": 0.6}
BoxLayout:
orientation: "vertical"
MDLabel:
text: "Welcome to the log in page"
text_size: self.size
font_size: 25
bold: True
halign: "center"
valign: "middle"
Image:
size_hint_y: 10
source: "kv/image.png"
MDTextField:
id: email
hint_text: "E-mail"
MDTextField:
id: password
hint_text: "Password"
password: True
MDFillRoundFlatButton:
id: btn
text: "Sign In"
width: dp(200)
pos_hint: {"center_x": .5}
on_press:print("pressed")
<BackgroundLayer#BoxLayout>:
orientation: "vertical"
BoxLayout:
orientation: "vertical"
canvas.before:
Color:
rgba: utils.get_color_from_hex("#00146e")
Rectangle:
pos: 0, self.center_y + self.height/3 - 50
size: (self.width,70)
BoxLayout:
orientation: "horizontal"
on_press:print("pressed") successfully prints "pressed"

Use this if you call a function from App class:
on_press: app.doThis()
And use this if you call a function from Screen class:
on_press: root.doThis()

Related

KivyMD: 'super' object has no attribute '__getattr__' during screen transition based on condition

I want to switch from login screen to menu screen based on a successful authentication, but this is the best I could do after a long search on condition-based screen transitions. Most sites say that screen-transitions in kivymd should be done using 'on-release' in .kv file, but I don't think that it would work in my code.
I've marked on the code the problematic line, which is raising the exception.
Teste.py
from kivy.lang import Builder
from kivymd.app import MDApp
from kivymd.uix.dialog import MDDialog
from kivymd.uix.button import MDFlatButton
from kivy.uix.screenmanager import ScreenManager, Screen
class login(Screen):
pass
class menu(Screen):
pass
Builder.load_file('lteste.kv')
class LoginApp(MDApp):
dialog = None
def build(self): #método construtor da parte visual do aplicativo
self.theme_cls.theme_style = "Light"
self.theme_cls.primary_palette = "Indigo"
self.theme_cls.accent_palette = "Blue"
self.sm = ScreenManager()
self.sm.add_widget(login(name="login"))
self.sm.add_widget(menu(name="menu"))
self.sm.current = "menu"
return self.sm
def dialog_box(self):
if not self.dialog:
self.dialog = MDDialog(
title="Log In",
text=f"Welcome {self.root.ids.user.text}!",
buttons=[MDFlatButton(text="Ok", text_color=self.theme_cls.primary_color,
on_release=self.close),],)
return self.dialog.open()
def login(self):
if self.root.ids.user.text=='1' and self.root.ids.password.text=='1':
self.sm.current = "menu" #<- problem
self.dialog_box()
return True
else:
return False
def close(self, instance):
self.dialog.dismiss()
LoginApp().run()
lteste.kv
<login>:
id: login
name: "login"
MDCard:
size_hint: None, None
size: 300, 600
pos_hint: {"center_x": 0.5, "center_y": 0.5}
elevation: 10
padding: 65
spacing: 35
orientation: 'vertical'
MDIcon:
icon: 'account'
icon_color: 0, 0, 0, 0
halign: 'center'
font_size: 180
MDTextFieldRound:
id: user
icon_left: "account-check"
hint_text: "Usuário"
foreground_color: 1, 0, 1, 1
size_hint_x: None
width: 220
font_size: 20
pos_hint: {"center_x": 0.5}
MDTextFieldRound:
id: password
icon_left: "key-variant"
hint_text: "Senha"
foreground_color: 1, 0, 1, 1
size_hint_x: None
height: 1
width: 220
font_size: 20
pos_hint: {"center_x": 0.5}
password: True
MDFillRoundFlatButton:
text: "ENTRAR"
font_size: 15
pos_hint: {"center_x": 0.5}
on_press: app.login()
MDFillRoundFlatButton:
text: "REGISTRAR-SE"
font_size: 15
pos_hint: {"center_x": 0.5}
<menu>
name: "menu"
id: menu
MDCard:
size_hint: None, None
size: 300, 600
pos_hint: {"center_x": 0.5, "center_y": 0.5}
elevation: 10
padding: 65
spacing: 35
orientation: 'vertical'
MDRaisedButton:
text: "Test"
The application root does not contain the ids you want. They are in the login screen widget because you defined them under it in kivy language. It would help to store a reference on the login screen to access them. Replace
self.sm.add_widget(login(name="login"))
with
self.login_screen = login(name="login")
self.sm.add_widget(self.login_screen)
Then, you can access the widgets like so,
text=f"Welcome {self.login_screen.ids.user.text}!",
and
if self.login_screen.ids.user.text=='1' \
and self.login_screen.ids.password.text=='1':
There is an example in the Kivy Documentation on kivy.uix.widget.Widget.ids and also Accessing Widgets defined inside Kv lang in your Python code.

Kivy - Get InputText From Other Screen

I am trying to type in text from one screen. Press a button and move to another screen and have that text be shown in a label. I've seen a few questions that are similar to mine, but have not been able to figure out how to use the posted solutions and have been stuck for hours (Link One, Link Two, Link Three). I believe that I need to use the __init__ method somewhere because this is an instance? I tried using the first link, but the label ends up blank (the code does run). Any Advice?
main.py
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.app import App
from kivy.lang.builder import Builder
class SecondWindow(Screen):
def get_unique_text(self):
x = self.manager.get_screen("first")
y = x.ids.unique.text
return str(y)
class FirstWindow(Screen):
pass
class MainWindow(Screen):
pass
class WindowManager(ScreenManager):
pass
kv_main = Builder.load_file('main.kv')
class MyApp(App):
def build(self):
return kv_main
if __name__ == '__main__':
MyApp().run()
main.kv
#:include First.kv
#:include Second.kv
WindowManager:
MainWindow:
FirstWindow:
SecondWindow:
<MainWindow>
name: "main"
BoxLayout:
Button:
text: "Press"
on_release:
app.root.current = "first"
First.kv
<FirstWindow#Screen>:
name: "first"
BoxLayout:
orientation: "vertical"
Label:
text: "Enter Unique Text for Saving"
font_size: 20
text_size: self.width, None
halign: 'center'
TextInput:
id: unique
hint_text: 'example: Stand25'
Button:
text: "Press"
on_release:
app.root.current = "second"
Second.kv
<SecondWindow#Screen>:
name: "second"
BoxLayout:
orientation: "vertical"
Label:
text: "Unique Text"
font_size: 20
text_size: self.width, None
halign: 'center'
Label:
text: root.get_unique_text()
font_size: 16
canvas.before:
Color:
rgba: 1,1,1,1
Rectangle:
pos: self.pos
size: self.size
color: 0,0,0,1
Button:
text: "Go Back"
on_release:
app.root.current = "first"
Another approach is to use the on_enter() method of a Screen in order to fetch the text. This also requires an id for the unique Label:
<SecondWindow#Screen>:
name: "second"
BoxLayout:
orientation: "vertical"
Label:
text: "Unique Text"
font_size: 20
text_size: self.width, None
halign: 'center'
Label:
id: unique # added id
# text: root.get_unique_text()
font_size: 16
canvas.before:
Color:
rgba: 1,1,1,1
Rectangle:
pos: self.pos
size: self.size
color: 0,0,0,1
Button:
text: "Go Back"
on_release:
app.root.current = "first"
Just add an on_enter() method to the SecondWindow class:
class SecondWindow(Screen):
def on_enter(self, *args):
self.ids.unique.text = self.get_unique_text()
def get_unique_text(self):
x = self.manager.get_screen("first")
y = x.ids.unique.text
return str(y)
In your Second.kv you can reference the text of the TextInput in the First.kv by making a couple changes to the kv files. First, in the main.kv, add an id for the FirstWindow (and eliminate the SecondWindow for now):
WindowManager:
MainWindow:
FirstWindow:
id: first # added id
# SecondWindow: # this gets added later
<MainWindow>
name: "main"
BoxLayout:
Button:
text: "Press"
on_release:
app.root.current = "first"
Then, in the Second.kv, set up the reference to the text of the TextInput:
<SecondWindow#Screen>:
name: "second"
BoxLayout:
orientation: "vertical"
Label:
text: "Unique Text"
font_size: 20
text_size: self.width, None
halign: 'center'
Label:
text: app.root.ids.first.ids.unique.text # reference to unique text
font_size: 16
canvas.before:
Color:
rgba: 1,1,1,1
Rectangle:
pos: self.pos
size: self.size
color: 0,0,0,1
Button:
text: "Go Back"
on_release:
app.root.current = "first"
Since the kv for SecondWindow uses app.root, it will cause an error if SecondWindow is instantiated before the root widget of the App is assigned. To avoid that, add the SecondWindow after a slight delay:
class MyApp(App):
def build(self):
Clock.schedule_once(self.add_second_screen)
return kv_main
def add_second_screen(self, dt):
self.root.add_widget(SecondWindow())

How to change screens from python code in Kivy

So I'm working on making a fully functional login screen for my first serious kivy app and I want to be able to change windows/screens when the user presses on a button. I know normally in the KV file i'd just use on release but I want the on release to call to a method to verify the users credentials, and if those credentials are correct then change screens. So how in python itself would I be able to call to screen manager to change the screen?
from kivy.app import App
from kivy.lang.builder import Builder
from kivy.uix.screenmanager import Screen, ScreenManager
class LoginLayout(Screen):
def login(self, **kwargs):
print("Login function working")
userEmail = self.ids.username.text
userPassword = self.ids.password.text
print(userEmail)
print(userPassword)
ScreenManager.current('emailWindow')
class EmailWindow(Screen):
pass
class WindowManager(ScreenManager):
pass
kv = Builder.load_file('loginScreen.kv')
class LoginScreen(App):
def build(self):
return kv
app = LoginScreen()
app.run()
KV
ScreenManager:
LoginLayout:
EmailWindow:
<LoginLayout>:
name: 'loginWindow'
canvas.before:
Color:
rgba: (28/255, 102/255, 137/255, 1)
Rectangle:
pos: self.pos
size: self.size
BoxLayout:
orientation: 'vertical'
size: root.width, root.height
Label:
text: 'Username'
font_name: 'Framd.ttf'
font_size: 20
TextInput:
id: username
multiline: False
size_hint: (.5, .3)
pos_hint: {'center_x' : .5}
Label:
text: 'Password'
font_name: 'Framd.ttf'
font_size: 20
TextInput:
id: password
multiline: False
size_hint: (.5, .3)
pos_hint: {'center_x' : .5}
Button:
text: 'Login'
size_hint: (.2, .8)
pos_hint: {'center_x' : 0.5}
font_name: 'Framd.ttf'
on_release: root.login()
Button:
text: 'Create Account'
size_hint: (.2, .8)
pos_hint: {'center_x' : 0.5}
font_name: 'Framd.ttf'
Button:
text: 'Forgot login Info'
size_hint: (.2, .8)
pos_hint: {'center_x' : 0.5}
font_name: 'Framd.ttf'
<EmailWindow>:
name: 'emailWindow'
canvas.before:
Color:
rgba: (28/255, 102/255, 137/255, 1)
Rectangle:
pos: self.pos
size: self.size
BoxLayout:
orientation: 'vertical'
size: root.width, root.height
Label:
text: 'To:'
font_name: 'Framd.ttf'
TextInput:
multiline: False
pos_hint: {'center_x': 0.5}
size_hint: (.5, .3)
font_name: 'Framd.ttf'
Label:
text: 'Subject'
TextInput:
multiline: False
pos_hint: {'center_x': 0.5}
size_hint: (.5, .3)
font_name: 'Framd.ttf'
Label:
text: 'Body'
font_name: 'Framd.ttf'
TextInput:
size_hint: (.5, .7)
pos_hint: {'center_x': 0.5}
multiline: True
Button:
text: 'send'
size_hint: (.2, .8)
pos_hint: {'center_x' : 0.5}
font_name: 'Framd.ttf'
When a Screen gets added to a ScreenManager, it gets a manager attribute set to the ScreenManager. So in your login() method you can do:
self.manager.current = 'emailWindow'
instead of:
ScreenManager.current('emailWindow')
Note that using ScreenManager, as you do above, references the ScreenManager class, not the ScreenManager instance that is in your App.

Accessing widget in child layout kivy

This is my code. I have a screen manager with two screens.
Screen 1: Login
Screen 2: Tabbed options
In screen 2 I have a dropdown widget in which I want to load some default values. But I am not able to access the id of the same.
Builder.load_string("""
<TACLogin>
FloatLayout:
MDToolbar:
title: "TEST"
pos_hint: {"x":0.001, "y":0.9}
MDRectangleFlatIconButton:
id: tac_screen1_next_id
icon: "page-next-outline"
font_size: '20sp'
font_name: 'fonts/prox_nova.ttf'
md_bg_color: 0, 0.502, 0.502, 1
text_color: 1,1,1,1
text: 'Login'
on_press: root.manager.current = 'tacconfig'
size_hint: None, None
size: dp(100), dp(30)
pos_hint: {"x":0.7, "y":0.2}
<TACConfig>
BoxLayout:
orientation:"vertical"
MDToolbar:
title: "Taxonomy Administration Console"
specific_text_color: app.theme_cls.accent_color
MDTabs:
id: android_tabs
text_color_normal: 1,1,1,1
Tab:
text:"Home"
text_color_normal: 1,1,1,1
MDLabel:
color: 0,0,0,1
font_size: '20sp'
font_name: 'fonts/prox_nova.ttf'
pos_hint: {"x":0.4, "y":0.1}
text:'WELCOME ADMIN'
Tab:
text_color_normal: 1,1,1,1
text:"Configure User"
TACUserConfig:
Tab:
text_color_normal: 1,1,1,1
text:"Configure DataSource"
TACScreen1:
Tab:
text_color_normal: 1,1,1,1
text:"Exit"
<TACUserConfig>
FloatLayout:
id: ucScreen_id
MDLabel:
color: 0,0,0,1
font_size: '15sp'
font_name: 'fonts/prox_nova.ttf'
text:'Select User Type'
pos_hint:{'center':(0.7,0.7)}
size_hint:0.8,1.4
MDDropDownItem:
id: user_type
pos_hint:{"x":0.5, "y":0.68}
dropdown_bg: [1, 1, 1, 1]
""")
This is my python code
class TACLogin(Screen, MDApp):
def __init__(self, **kwargs):
super(TACLogin, self).__init__(**kwargs)
class TACUserConfig(Screen, MDApp):
def __init__(self, **kwargs):
super(TACUserConfig, self).__init__(**kwargs)
print(self.ids)
def on_start(self):
self.ids.ucScreen_id.ids.user_type.items = ["Business User", "Admin User"]
sm = ScreenManager()
sm.add_widget(TACLogin(name='taclogin'))
sm.add_widget(TACConfig(name='tacconfig'))
sm.add_widget(TACUserConfig(name='tacuserconfig'))
class TestApp(MDApp):
def build(self):
self.theme_cls.primary_palette = "Teal"
return sm
if __name__ == '__main__':
TestApp().run()
I am trying to add values to the dropdown,the on_start function is not fired at all and I am not able to access the id of the dropdown user_type. Can someone please help me out?

KivyMD 0.103.0 causing errors with 'NavigationDrawerSubheader'

I recently updated kivyMD from 0.102.1 to 0.103.0 and i'm getting the following error:
raise FactoryException('Unknown class <%s>' % name)
kivy.factory.FactoryException: Unknown class
But when go back to version 0.102.1 everything works just fine. I'll post the code below but I just wanted to know if I wanted to update to 0.103.0 what do I need to change? I've tried to do some research but unable to find something that will fix the problem.
.py
#imported from kivy framework
from kivy.app import App
from kivymd.app import MDApp
from kivy.app import App
from datetime import datetime
from datetime import timedelta
from kivy.clock import Clock
from kivy.lang import Builder
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.uix.image import Image
import weatherGrab
from weatherGrab import weatherCheck
import os
#1st screen
class Login_Screen(Screen):
#Takes user input from the .KV file, converts it to string and verifies if its a saved login
def verify_credentials(self):
Username = self.ids.Username_userInput
Password = self.ids.Password_userInput
Username_string = Username.text
Password_string = Password.text
#Allows the variable to be used in another class and method
Login_Screen.verify_credentials.GGG = Username.text
#checks if user input is equal to temp database
if self.ids["Username_userInput"].text == "Username" and self.ids["Password_userInput"].text == "Password":
self.manager.current = "Homepage_Screen"
print("USER LOGIN DATA: " + Username_string +" "+Password_string)
weatherGrab.weatherCheck()
#print('CURRENT WEATHER - London','\n',weatherCheck.currentWeather,'\n' ,weatherCheck.temp)
#print('HERE',var1)
#x = dir(platform) prints all function from that lib
#after log in, sets user input to empty so the next user can login
def clean(self):
self.ids["Username_userInput"].text = ""
self.ids["Password_userInput"].text = ""
#saving user inputs to a text file (temp database)
def save_data(self):
Username = self.ids.Username_userInput
Password = self.ids.Password_userInput
Username_string = Username.text
Password_string = Password.text
TextDoc = open("UserLogin.txt", "a")
username = Username_string
password = Password_string
if username == '' and password == '':
pass
else:
TextDoc.write("\n"+username+","+password)
TextDoc.close()
#loads data from the file (debugging/testing)
def load_data(self):
f = open("UserLogin.txt", "r")
print("FROM TEXT FILE:"+ f.read())
#2nd screen
class Homepage_Screen(Screen):
#Event dispatcher to load data when user enters the second screen
def on_enter(self):
self.load_info()
self.weather()
def weather(self):
self.ids["temp"].text = weatherCheck.temp
self.ids["date"].text = weatherCheck.currentDate
#Text prints in termial for testing/debugging
def load_info(self):
print("PASSING USERNAME TO HOMEPAGE: "+Login_Screen.verify_credentials.GGG)
self.ids["USERNAME"].text = "Welcome"+" "+Login_Screen.verify_credentials.GGG
#Saves User input from the notes textinput
def save_notes(self):
UserNotes = self.ids.UserInput_notes
UserNote = UserNotes.text
TextDoc = open("UserLogin.txt", "a")
TextDoc.write("," + UserNote)
TextDoc.close()
#3rd screen
class Application_Screen(Screen):
pass
#4th screen
class Logout_Screen(Screen):
def newline(self):
TextDoc = open("UserLogin.txt", "a")
TextDoc.write("\n")
TextDoc.close()
def forcequit(self):
exit()
#class for all screens
class ScreenManagement(ScreenManager):
pass
class MainApp(MDApp):
def build(self):
#declaring time from python, and making it refresh every second
self.now = datetime.now()
Clock.schedule_interval(self.update_clock, 1)
def update_clock(self, *args):
self.now = self.now + timedelta(seconds=1)
#Allows for time to be shown on all screens
self.root.get_screen("Homepage_Screen").ids["CurrentTime"].text = self.now.strftime("%H:%M:%S")
self.root.get_screen("Logout_Screen").ids["CurrentTime"].text = self.now.strftime("%H:%M:%S")
self.root.get_screen("Login_Screen").ids["CurrentTime"].text = self.now.strftime("%H:%M:%S")
#print(self.now.strftime("%H:%M:%S"))
MainApp().run()
.kv
#:kivy 1.0
#:import hex kivy.utils.get_color_from_hex
#styles that will apply to all intences for each tag
<MDRaisedButton>:
font_size:18
<Label>:
color: 0,0,0,1
#declaring screen managers and printing them in this order
ScreenManagement:
Login_Screen:
name:"Login_Screen"
id: woow
Homepage_Screen:
name:"Homepage_Screen"
Application_Screen:
name:"Application_Screen"
Logout_Screen:
name:"Logout_Screen"
#style for login screen
<Login_Screen>:
#background color
FloatLayout:
spacing: 10
canvas.before:
Color:
rgba: hex('#eff3fa')
Rectangle:
size: self.size
pos: self.pos
#Navbar
MDToolbar:
id: fb
pos_hint: {'center_x': 0.5, 'top':1.0}
size_hint_y:None
height: 50
title: "Virtual Assistant"
md_bg_color: hex('#132843')
Label:
id: CurrentTime
font_size:18
size_hint_x: .1
color: (1,1,1,1)
#login container
#background color/positioning
BoxLayout:
spacing: 10
orientation: 'vertical'
padding: 50
canvas.before:
Color:
rgba: hex('#000')
Rectangle:
size: self.size
pos: self.pos
pos_hint: {'center_x': 0.5, 'center_y': 0.5}
size_hint: 0.33, None
size_hint_min_x: 200
height: self.minimum_height
#LOGIN CONTENT
#logo
Image:
source: 'Logo.png'
size_hint: None, None
size: 100, 100
pos_hint: {'center_x': 0.5, 'center_y': 0.0}
MDTextField:
id: Username_userInput
hint_text:"Username"
text:"Username"
line_color_normal: 0,0,0,1
MDTextField:
id: Password_userInput
hint_text:"Password"
text:"Password"
password: True
line_color_normal: 0,0,0,1
#color_mode:'accent'
Button:
text:"Login"
size_hint_y: None
height: 60
padding: 10,10
background_color: (2.08, 2.40, 1.92,1)
size_hint: 0.40, None
pos_hint: {'center_x': 0.5, 'center_y': 0.0}
on_press: root.verify_credentials() , root.save_data(), root.clean(), root.load_data()
#style for Homepage screen
<Homepage_Screen>:
#SIDEBAR BUTTONS
NavigationLayout:
id: nav_layout
MDNavigationDrawer:
drawer_logo:'Logo.png'
NavigationDrawerSubheader:
id: USERNAME
NavigationDrawerIconButton:
icon:"home"
text:"Homepage"
theme_text_color: 'Custom'
on_release:
screen_manager.current = "Homepage"
NavigationDrawerIconButton:
icon:'application'
text: "Application"
on_release:
screen_manager.current = "Application"
NavigationDrawerIconButton:
icon: 'dictionary'
text: "Dictionary"
on_release:
screen_manager.current = "Dictionary"
MDRectangleFlatIconButton:
icon:'logout'
text: "Logout"
#on_press: root.clean()
on_release: app.root.current = "Logout_Screen"
size_hint: 1, None
font_size:20
text_color: 0,0,0,1
#BACKGROUND
FloatLayout:
spacing: 10
canvas.before:
Color:
rgba: hex('#eff3fa')
Rectangle:
size: self.size
pos: self.pos
#NAVBAR
MDToolbar:
id: fb
pos_hint: {'center_x': 0.5, 'top':1.0}
size_hint_y:None
height: 50
title: "Virtual Assistant"
md_bg_color: hex('#132843')
left_action_items: [['menu', lambda x: root.ids.nav_layout.toggle_nav_drawer()]]
Label:
id: CurrentTime
size_hint_x: .1
font_size:18
color: (1,1,1,1)
#SIDEBAR SCREEN STYLE
ScreenManager:
id: screen_manager
#HOMEPAGE SCREEN STYLE
Screen:
name: "Homepage"
BoxLayout:
spacing: 10
orientation: 'vertical'
padding: 10
canvas.before:
Color:
rgba: (1,1,1,.8)
Rectangle:
size: self.size
pos: self.pos
pos_hint: {'center_x': 0.5, 'top': (root.height - fb.height)/root.height}
size_hint: 0.3, None
height: 35
GridLayout:
rows: 3
cols: 3
padding: 10
spacing: 15
#pos_hint: {"center_x":0.6, "center_y":0.0}
Label:
id:date
color: (0,0,0,1)
size_hint_x: 2
Label:
id:temp
color: (0,0,0,1)
size_hint_x: 2
Label:
text:'icon'
color: (0,0,0,1)
size_hint_x: 2
BoxLayout:
orientation: 'horizontal'
spacing: 10
padding: 10
canvas.before:
Color:
rgba: (1,1,1,1)
Rectangle:
size: self.size
pos: self.pos
size_hint: 0.8, None
height: 60
pos_hint: {'center_x': .5, 'center_y':.5}
TextInput:
height:60
size_hint: 5, None
focus: True
multiline: False
font_size: 25
padding_y:15
background_color: 1,1,1,0
foreground_color: 0,0,0,1
pos_hint:{'center_x':0, 'center_y':0.5}
MDRectangleFlatIconButton:
icon:'search-web'
height:45
text_color: 0,0,0,1
md_bg_color: hex("#D0F0C0")
pos_hint: {'center_x': 0.5, 'center_y': 0.5}
Label:
text:'Search'
font_size:18

Categories