Python Kivymd - AttributeError object has no attribute - python

Not sure where I'm going wrong, When changing the value of MDSlider it should update a label but I receive the error
the kv is loaded as a string within my py file, if I test out the slider by simply printing the value to the console it works. but when I try to update a label get the following error??
AttributeError: 'Level' object has no attribute 'training_level'
here's my code
from kivy.lang import Builder
from kivymd.uix.screen import MDScreen
from kivymd.app import MDApp
KV = """
ScreenManager:
Profile:
Level:
Routine:
Start:
<Profile>:
name: "Profile"
canvas.before:
Color:
rgba: (1,1,1,1)
Rectangle:
source: "bg.jpg"
size: root.width, root.height
pos: self.pos
MDLabel:
text: "Select a Profile"
font_size: "32"
pos_hint: {"center_x": .5, "center_y": .95}
MDRectangleFlatButton:
text: "Guest"
font_size: "32"
pos_hint: {"center_x": .5, "center_y": .5}
on_release: app.root.current = "Level"
MDBottomAppBar:
MDToolbar:
title: "HIIT"
icon: "account-cog"
type: "bottom"
left_action_items: [["menu", lambda x: x]]
mode: "center"
<Level>:
name: "Level"
canvas.before:
Color:
rgba: (1,1,1,1)
Rectangle:
source: "bg.jpg"
size: root.width, root.height
pos: self.pos
MDLabel:
text: "What is your Level of training?"
font_size: "32"
pos_hint: {"center_x": .5, "center_y": .95}
MDLabel:
id: "training_level"
theme_text_color: "Custom"
text_color: 1,1,1,1
halign: "center"
text: "2"
font_size: "128"
pos_hint: {"center_x": .5, "center_y": .65}
MDSlider:
min: 1
max: 3
value: 2
size: 500, 50
size_hint: None, None
hint: False
step: 1
orientation: "horizontal"
pos_hint: {"center_x": .5, "center_y": .40}
on_value: root.change_height(*args)
MDRectangleFlatButton:
text: "Next"
font_size: "32"
pos_hint: {"center_x": .92, "center_y": .18}
on_release: app.root.current = "Routine"
MDBottomAppBar:
MDToolbar:
title: "HIIT"
icon: "account-cog"
type: "bottom"
left_action_items: [["menu", lambda x: x]]
mode: "center"
<Routine>:
name: "Routine"
canvas.before:
Color:
rgba: (1,1,1,1)
Rectangle:
source: "bg.jpg"
size: root.width, root.height
pos: self.pos
MDLabel:
text: "Select a Routine"
font_size: "32"
pos_hint: {"center_x": .5, "center_y": .95}
MDRectangleFlatButton:
text: "10 Minute Beginner"
font_size: "32"
pos_hint: {"center_x": .5, "center_y": .5}
on_release: app.root.current = "Start"
MDBottomAppBar:
MDToolbar:
title: "HIIT"
icon: "account-cog"
type: "bottom"
left_action_items: [["menu", lambda x: x]]
mode: "center"
<Start>:
name: "Start"
canvas.before:
Color:
rgba: (1,1,1,1)
Rectangle:
source: "bg.jpg"
size: root.width, root.height
pos: self.pos
MDRectangleFlatButton:
text: "Stop"
font_size: "32"
pos_hint: {"center_x": .5, "center_y": .5}
on_release: app.root.current = "Profile"
MDBottomAppBar:
MDToolbar:
title: "HIIT"
icon: "account-cog"
type: "bottom"
left_action_items: [["menu", lambda x: x]]
mode: "center"
"""
class Profile(MDScreen):
pass
class Level(MDScreen):
def change_height(self, *args):
#print(str(round(args[1],1)))
self.training_level.text = str(round(args[1],1))
pass
class Routine(MDScreen):
pass
class Start(MDScreen):
pass
class MainApp(MDApp):
def build(self):
self.theme_cls.theme_style = "Dark"
self.theme_cls.primary_palette = "Blue"
return Builder.load_string(KV)
MainApp().run()

Related

How should i call a new screen?

I have a ScreenManager problem (Lack of knowledge).
I can't call another screen from a button on my RecycleView.
Note that I have 2 ScreenManager, on the first I login and I am directed to other screens of another ScreenManager.
Note in the line that contains "# <<<< HERE" the way I call the new screen.
import json
from kivymd.app import MDApp
from kivy.lang import Builder
from kivy.properties import StringProperty
from kivy.properties import ObjectProperty
from kivy.uix.relativelayout import RelativeLayout
from random import sample, choice
from string import ascii_lowercase
from kivy.uix.screenmanager import Screen
from kivy.uix.boxlayout import BoxLayout
sample_images = [
"https://cdn.neemo.com.br/uploads/settings_webdelivery/logo/5591/No-Image.jpg",
"https://upload.wikimedia.org/wikipedia/commons/thumb/5/5f/SL_Bundala_NP_asv2020-01_img08.jpg/640px-SL_Bundala_NP_asv2020-01_img08.jpg",
"https://upload.wikimedia.org/wikipedia/commons/thumb/b/b6/Palaeobranchiostoma_hamatotergum.jpg/482px-Palaeobranchiostoma_hamatotergum.jpg",
"https://upload.wikimedia.org/wikipedia/commons/thumb/a/ac/No_image_available.svg/1024px-No_image_available.svg.png",
]
KV = '''
<ContentNavigationDrawer>:
orientation: 'vertical'
FloatLayout:
size_hint_y: None
height: "200dp"
BoxLayout:
id: box_image
x: root.x
pos_hint: {"top": 1}
FloatLayout:
# Imagem de fundo
FitImage:
pos_hint: {'center_x': .5, 'center_y': .5}
source: "./images/menu.png"
# Imagem do usuário
FitImage:
pos_hint: {'center_x': .5, 'center_y': .5}
source: "./images/user.png"
size_hint: None, None
width: dp(150)
height: dp(150)
radius: [99, 99, 99, 99]
MDLabel:
text: "Coletor de dados Postgres"
size_hint_y: None
height: self.texture_size[1]
# Define a posição do Label
x: root.x + 10
y: root.height - box_image.height + dp(10)
ScrollView:
MDList:
OneLineIconListItem:
text: "Tela Inicial"
on_press:
root.nav_drawer.set_state("close")
root.screen_manager.current = 'tela_item'
IconLeftWidget:
icon: "view-list"
## Tamanho do ícone user_font_size: "72sp"
OneLineIconListItem:
text: "Outra Tela"
on_press:
root.nav_drawer.set_state("close")
root.screen_manager.current = 'tela_signup'
IconLeftWidget:
icon: "database-export-outline"
OneLineIconListItem:
text: "Imagem maior"
on_press:
root.nav_drawer.set_state("close")
root.screen_manager.current = 'tela_login'
IconLeftWidget:
icon: "database-export-outline"
<MainScreen>:
MDToolbar:
id: toolbar
pos_hint: {"top": 1}
elevation: 10
title: "Pesquise e compre."
left_action_items: [["menu", lambda x: nav_drawer.set_state("open")]]
right_action_items: [['lightbulb-outline', lambda x: app.color()], ['cart', lambda x: app.compras()]]
MDNavigationLayout:
x: toolbar.height
ScreenManager:
id: screen_manager
ScreenRecycleView
TelaLogin
TelaSingUp
TelaItem
MDNavigationDrawer:
id: nav_drawer
ContentNavigationDrawer:
screen_manager: screen_manager
nav_drawer: nav_drawer
<MyImageCard>:
name: 'my_image_card'
AsyncImage:
source: root.source
Label:
size_hint_y: None
height: dp(48)
text: root.text
color: 'black'
canvas:
Color:
rgba: 0, 0, 0, .3
Rectangle:
size: self.size
MDFlatButton:
text: "New Screen Here"
increment_width: "164dp"
#app.root.ids.sm.get_screen('main').ids.screenmanager.current = 'new_screen'
on_release:
root.screen_manager.current = 'tela_item' # <<<< HERE
<TelaItem>:
name: 'tela_item'
FloatLayout:
orientation: "vertical"
id: body_tela_item
FitImage:
pos_hint: {'center_x': .5, 'center_y': .85}
source: "./images/eu.jpeg"
size_hint: None, None
width: dp(90)
height: dp(90)
radius: [99, 99, 99, 99]
MDRaisedButton:
text: 'Add'
size_hint: .9, None
pos_hint: {'center_x': .5, 'center_y': .5}
on_release: root.singup()
MDRaisedButton:
text: 'Back'
size_hint: .9, None
pos_hint: {'center_x': .5, 'center_y': .3}
on_release: root.singup()
<ScreenRecycleView>:
name: 'recycle_view'
FloatLayout:
MDBoxLayout:
pos_hint: {'center_x': 0.5, 'center_y': 0.4}
RecycleView:
id: rv
viewclass: "MyImageCard"
RecycleGridLayout:
cols: 2
row_default_height: (self.width - self.cols*self.spacing[0]) / self.cols
padding: dp(4), dp(4)
spacing: dp(4)
size_hint_y: None
height: self.minimum_height
default_size_hint: 1, None
default_size: None, dp(500)
<TelaLogin>:
name: 'tela_login'
FloatLayout:
orientation: "vertical"
id: body_tela_login
FitImage:
pos_hint: {'center_x': .5, 'center_y': .85}
source: "./images/eu.jpeg"
size_hint: None, None
width: dp(90)
height: dp(90)
radius: [99, 99, 99, 99]
MDRaisedButton:
text: 'Login'
size_hint: .9, None
pos_hint: {'center_x': .5, 'center_y': .5}
on_release: root.login()
<TelaSingUp>:
name: 'tela_singup'
id: body_tela_singup
FloatLayout:
MDIconButton:
icon: "arrow-left-bold"
pos_hint: {"center_x": .1, "center_y": .9}
on_release: app.root.current = 'tela_login'
FitImage:
pos_hint: {'center_x': .5, 'center_y': .8}
source: "./images/user.png"
size_hint: None, None
width: dp(150)
height: dp(150)
radius: [99, 99, 99, 99]
MDRaisedButton:
text: 'Cadastrar'
size_hint: .9, None
pos_hint: {'center_x': .5, 'center_y': .1}
on_release: root.singup()
ScreenManager:
id: sm:
TelaLogin:
name: 'tela_login'
MainScreen:
name: 'main'
'''
class ContentNavigationDrawer(BoxLayout):
screen_manager = ObjectProperty()
nav_drawer = ObjectProperty()
class MainScreen(Screen):
pass
class TelaSingUp(Screen):
pass
class TelaItem(Screen):
pass
class TelaLogin(Screen):
def login(self):
self.manager.current = 'main'
class MyImageCard(RelativeLayout):
text = StringProperty()
source = StringProperty()
class ScreenRecycleView(Screen):
def on_kv_post(self, base_widget):
self.ids.rv.data = [
{
'source': choice(sample_images),
'text': ''.join(sample(ascii_lowercase, 6))
}
for x in range(50)
]
class MyApp(MDApp):
def build(self):
root = Builder.load_string(KV)
return root
MyApp().run()

Kivymd not able to keep label and textfield in same row

I have created a form with kivymd label and textfield but somehow the labels and the textfields are not in proper alignment with each other. The mdlabel is aligning a little above the row of mdtextfield with pos_hint function. My codes are below:
#.py
from kivymd.app import MDApp
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.button import Button
from kivy.uix.screenmanager import Screen
from kivy.properties import *
class Main(Screen):
pass
class MyApp(MDApp):
def build(self):
return Main()
MyApp().run()
#.kv
#:import Vector kivy.vector.Vector
<Main>:
MDNavigationLayout:
ScreenManager:
id: screen_manager
Screen:
name: "challan"
MDBoxLayout:
orientation: 'vertical'
MDToolbar:
title: "My App"
left_action_items: [["menu", lambda x: nav_drawer.set_state("open")]]
MDLabel:
text:'Date'
pos_hint: {"center_x": .5, "top": 1}
theme_text_color:'Primary'
MDTextField:
id:date
hint_text: "Date"
pos_hint: {"center_x": .5, "top": 1}
size_hint:(None,None)
width: 300
MDLabel:
text:'Challan No.'
pos_hint: {"center_x": .5, "top": 1}
theme_text_color:'Primary'
MDTextField:
id: challan
hint_text: "Challan No."
pos_hint: {"center_x": .5, "top": 1}
size_hint:(None,None)
width:300
MDLabel:
text:'Quantity'
pos_hint: {"center_x": .5, "top": 1}
theme_text_color:'Primary'
MDTextField:
id:qty
hint_text: "Quantity"
pos_hint: {"center_x": .5, "top": 1}
size_hint:(None,None)
width: 300
MDLabel:
text:'From Location'
pos_hint: {"center_x": .5, "top": 1}
theme_text_color:'Primary'
MDTextField:
id: flo
hint_text: "From Location"
pos_hint: {"center_x": .5, "top": 1}
size_hint:(None,None)
width:300
Screen:
name: "Message"
BoxLayout:
orientation: 'vertical'
MDToolbar:
title: "My App"
left_action_items: [["menu", lambda x: nav_drawer.set_state("open")]]
MDLabel:
text:"Email: "
# font_size: (root.width**2 + root.height**2) / 17**4
pos_hint: {"x":0.1, "top":0.9}
size_hint: 0.25, 0.15
MDTextField:
id:namee
hint_text: "Name"
helper_text:"forget"
pos_hint : {'center_x':0.0 ,'center_y':0.0}
size_hint_x : None
width: 300
MDNavigationDrawer:
id:nav_drawer
opening_transition:'out_bounce'
opening_time:1
BoxLayout:
orientation:'vertical'
MDRectangleFlatIconButton:
icon: "android"
size_hint_x: 1
text: 'Android'
on_release:
screen_manager.current = "challan"
MDRectangleFlatIconButton:
icon: "magnify"
size_hint_x: 1
text: 'Search'
on_release:
screen_manager.current = "Message"
Widget:
I want to keep the label and the text field in same row in alignment to each other.
The MDBoxLayout design intent is to place each child in a separate row when orientation is vertical. If you want items aligned horizontally, you can use MDBoxLayout with orientation of horizontal (which is the default).
In your case, one way to accomplish your goal is to put the pairs of MDLabel and MDTextInput each in their own horizontal MDBoxLayout. For example:
Screen:
name: "challan"
MDBoxLayout:
orientation: 'vertical'
MDToolbar:
title: "My App"
left_action_items: [["menu", lambda x: nav_drawer.set_state("open")]]
MDBoxLayout:
MDLabel:
text:'Date'
pos_hint: {"center_y": .5}
theme_text_color:'Primary'
MDTextField:
id:date
hint_text: "Date"
pos_hint: {"center_y": .5}
size_hint:(None,None)
width: 300
MDBoxLayout:
MDLabel:
text:'Challan No.'
pos_hint: {"center_y": .5}
theme_text_color:'Primary'
MDTextField:
id: challan
hint_text: "Challan No."
pos_hint: {"center_y": .5}
size_hint:(None,None)
width:300
Similarly, for the rest of the items that you want on their own row.

How to align the top row properly, I tried a few different things not working... image given below

.KV code part
MDGridLayout:
cols: 4
adaptive_height: True
#md_bg_color: app.theme_cls.primary_color
MDIcon:
halign: "center"
icon: 'magnify'
pos_hint: {"x": .00}
size_hint:
MDTextField:
id: symbol_field
hint_text: " Search by STOCK KEY"
pos_hint: {"x": .05}
on_text_validate: root.Pressed()
required: True
helper_text_mode: "on_error"
helper_text: ""
MDIconButton:
halign: "center"
icon: "arrow-right-thick"
pos_hint: {"x": .90}
on_press: root.Pressed()
MDIconButton: #new
halign: 'center'
icon: 'cog'
pos_hint: {'x': .95}
on_press: root.settings()
The weird alignment not able to change it The top bar
It should be like:
'label' [0-0.05] 'text-field' [0.05-0.90] 'button' [0.90-0.95] 'button' [0.95-1]
You can try this one, it is not using MDGridLayout (the nature of the Grid, alingment is really hard to do), in this example I am using FloatLayouts plus BoxLayouts plus canvas:
Screen:
canvas:
Color:
rgba: [0,0,0,.1]
Rectangle:
pos: self.pos
size: self.size
#START
FloatLayout:
BoxLayout:
pos_hint: {"center_x": .5, "center_y": 1.4}
padding: dp(15)
#Control the background here jbsidis
canvas.after:
Color:
rgba: [1,1,1,1]
RoundedRectangle:
pos: self.pos[0],self.pos[1] #-dp(15)
size: self.size[0],dp(80)
radius: [dp(8),dp(8),dp(8),dp(8)]
#source: "jbsidis_background.png"
BoxLayout:
pos_hint: {"center_x": .4, "center_y": 1.0}
size_hint: .8,None
spacing: dp(3)
MDIconButton:
pos_hint: {"center_x": .1, "center_y": .25}
halign: "center"
icon: 'magnify'
FloatLayout:
BoxLayout:
pos_hint: {"center_x": .7, "center_y": .5}
MDTextField:
id: symbol_field
hint_text: " Search by STOCK KEY"
#on_text_validate: root.Pressed()
required: True
helper_text_mode: "on_error"
helper_text: ""
MDIconButton:
halign: "center"
icon: "arrow-right-thick"
#on_press: root.Pressed()
MDIconButton:
halign: 'center'
icon: 'pencil'
#on_press: root.settings()
Here is the image (the one in the left side):

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.

Im not able to add OneLineListItem inside of MDList

I want to add text using OneLineListItem from the python module kivymd. When I run my code I only get the scrollview and no text inside the screen. I'm not sure what I'm doing wrong. I would like to get any ideas from anyone. I posted the code here below feel free to look at the code. Hello people I need a solution to my issue. Thanks!!
from kivymd.app import MDApp
from kivy.core.window import Window
from kivymd.uix.list import ThreeLineAvatarListItem, ImageLeftWidget
Window.size = (360, 500)
class DemoApp(MDApp):
def build(self):
self.theme_cls.primary_palette = "Yellow"
self.theme_cls.primary_hue = 'A400'
self.theme_cls.theme_style = 'Dark'
pass
def on_start(self):
for i in range(10):
image = ImageLeftWidget(source="soldier.jpg")
items = ThreeLineAvatarListItem(text="Item " + str(i), secondary_text="Hello World", tertiary_text="Third text")
items.add_widget(image)
self.root.ids.container.add_widget(items)
#:include firebaseloginscreen.kv
#:import FirebaseLoginScreen firebaseloginscreen.FirebaseLoginScreen
#:import utils kivy.utils
#: import FadeTransition kivy.uix.screenmanager.FadeTransition
#: import SlideTransition kivy.uix.screenmanager.SlideTransition
#FloatLayout:
ScreenManager:
id: screen_manager
canvas.before:
Color:
rgb: 1,1,1
Rectangle:
size: self.size
pos: self.pos
FirebaseLoginScreen:
canvas.before:
Rectangle:
size: self.size
pos: self.pos
source: "heart.png"
id: firebase_login_screen
name: "firebase_login_screen"
size_hint: 1,1
pos_hint: {"top": 1, "right": 1}
web_api_key: "AIaSyCqafRzds38uZDLlKuI"
primary_color: utils.get_color_from_hex("#e6e600")#("#EE682A")
secondary_color: utils.get_color_from_hex("#060809")
tertiary_color: utils.get_color_from_hex("#434343")
on_login_success:
app.user_localId = self.localId
app.user_idToken = self.idToken
screen_manager.transition = FadeTransition(duration=0.01)
screen_manager.current = "main_app_screen"
#screen_manager.transition.direction = 'right'
print(firebase_login_screen.refresh_token_file)
Screen:
name: "main_app_screen"
NavigationLayout:
ScreenManager:
Screen:
name: "main_app_screen"
canvas.before:
Rectangle:
size: self.size
pos: self.pos
source: "3cr_2.png"
BoxLayout:
orientation: 'vertical'
spacing: '0.5dp'
MDToolbar:
title: "Tools"
left_action_items: [["menu", lambda x: nav_drawer.toggle_nav_drawer()]]
MDIconButton:
icon: 'message'
on_press: screen_manager.current = "messages"
theme_text_color: 'Custom'
md_bg_color: app.theme_cls.primary_color
MDBottomAppBar:
MDToolbar:
title: 'Calendar'
left_action_items: [['calendar', lambda x: app.calendar()]]
mode: 'free-end'
icon: 'sword'
on_action_button: app.navigation_draw()
Widget:
MDNavigationDrawer:
id: nav_drawer
BoxLayout:
orientation: 'vertical'
spacing: '8dp'
padding: '8dp'
MDCard:
size_hint: None, None
size: 170,200
pos_hint: {'center_x':0.5, 'center_y':0.8}
Image:
source: 'happydude.jpg'
MDLabel:
text: 'John Doe'
font_style: 'Subtitle1'
size_hint_y: None
height: self.texture_size[1]
theme_text_color: 'Custom'
text_color: (241/255,196/255,15/255,0.8)
MDLabel:
text: 'jonh83e#outlook.com'
font_style: 'Caption'
size_hint_y: None
height: self.texture_size[1]
theme_text_color: 'Custom'
text_color: (241/255,196/255,15/255,0.8)
ScrollView:
MDList:
OneLineIconListItem:
text: 'Profile'
theme_text_color: 'Custom'
text_color: (241/255,196/255,15/255,0.8)
on_press: screen_manager.current = "profile"
IconLeftWidget:
icon: 'face-profile-woman'
OneLineIconListItem:
text: 'Upload'
theme_text_color: 'Custom'
text_color: (241/255,196/255,15/255,0.8)
on_press: screen_manager.current = "upload"
IconLeftWidget:
icon: 'file-upload'
OneLineIconListItem:
text: 'Logout'
theme_text_color: 'Custom'
text_color: (241/255,196/255,15/255,0.8)
IconLeftWidget:
icon: 'logout'
Screen:
id: upload
name: 'upload'
MDLabel:
text: 'Lets upload some files'
halign: 'center'
MDRectangleFlatButton:
text: 'Back'
pos_hint: {'center_x': 0.5, 'center_y': 0.2}
on_press: screen_manager.current = 'main_app_screen'
Screen:
id: messages
name: 'messages'
BoxLayout:
orientation: 'vertical'
MDToolbar:
title: "Messages Center"
MDIconButton:
icon: 'keyboard-return'
on_press: screen_manager.current = "main_app_screen"
theme_text_color: 'Custom'
md_bg_color: app.theme_cls.primary_color
# Im trying to add it here below:
ScrollView:
MDList:
id: container
#Widget:
After not giving up, I finally found the issue. By default the text color was white, same as the color of the screen. I had to change the color of my text, and to do so I used the parameters ---> OneLineListItem(theme_text_color="Custom",
text_color=(241 / 255, 196 / 255, 15 / 255, 0.8))

Categories