Kivy ScrollView cutting off part of label - python

I am currently experiencing an issue when trying to use a GridLayout with a ScrollView, in that the top half of the labels in the GridLayout are being cut off by the ScrollView.
For example, here is what it currently looks like:
And, here is the .kv code for this section (it is part of a BottomNavigation):
MDBottomNavigationItem:
id: hmNav
name: 'home'
text: 'Home'
icon: 'home'
GridLayout:
id: hmGrid
cols: 1
rows_minimum: {0: (self.parent.height) * 0.05, 1: (self.parent.height) * 0.2, 2: (self.parent.height) * 0.4, 3: (self.parent.height) * 0.1, 4: (self.parent.height) * 0.1}
row_force_default: True
MDLabel:
id: welcomeLabel
halign: 'center'
font_name: "DMSans"
text: "Hello, " + app.app.getId() + "!"
theme_text_color: "Custom"
font_size: '25sp'
size: self.texture_size
text_color: get_color_from_hex("#08421e")
MDLabel:
id: wLabel2
halign: 'center'
font_name: "DMSans"
text: "Here are your selected ingredients:"
theme_text_color: "Custom"
font_size: '15sp'
size: self.texture_size
text_color: get_color_from_hex("#08421e")
ScrollView:
id: selectedScroll
size: (self.parent.width, self.parent.height)
do_scroll_x: False
do_scroll_y: True
bar_width: 20
GridLayout:
id: selectedGrid
size_hint_y: None
spacing: 60
cols: 2
height: self.minimum_height
MDLabel:
halign: 'center'
text: "TEST1"
font_size: '15sp'
theme_text_color: "Custom"
text_color: get_color_from_hex("#08421e")
size: self.texture_size
MDLabel:
halign: 'center'
text: "TEST2"
font_size: '15sp'
size: self.texture_size
MDLabel:
halign: 'center'
text: "TEST1"
font_size: '15sp'
theme_text_color: "Custom"
text_color: get_color_from_hex("#08421e")
size: self.texture_size
MDLabel:
halign: 'center'
text: "TEST2"
font_size: '15sp'
size: self.texture_size
MDLabel:
halign: 'center'
text: "TEST1"
font_size: '15sp'
theme_text_color: "Custom"
text_color: get_color_from_hex("#08421e")
size: self.texture_size
MDLabel:
halign: 'center'
text: "TEST2"
font_size: '15sp'
size: self.texture_size
MDLabel:
halign: 'center'
text: "TEST 3"
font_size: '15sp'
size: self.texture_size
MDLabel:
halign: 'center'
text: "TEST 4"
font_size: '15sp'
size: self.texture_size
I have used a ScrollView with a BoxLayout successfully, using much of the same configuration as this GridLayout, but I'm unsure of why the top labels are being cut off in this particular instance.
Any help would be greatly appreciated!
Thanks.

When you use height: self.minimum_height in a GridLayout (and others), it calculates the height of the GridLayout based on the height of its children. This means that those children must have explicit height values. You have specified size: self.texture_size for each MDLabel, but that will have no effect if size_hint is left at the default of (1,1). To fix it, just add:
size_hint_y: None
to each of the MDLabels.

Related

Nav Bar doesn't cover screen when opened

I'm building a registration form screen in Kivy. I have some other basic screens as part of the nav bar. However, this is the first one I'm really adding some content to. I have some round text fields that I've just thrown on there to get an idea of spacing, but currently when I reopen the NAV the bar the text field buttons appear in front of it and I want it to be behind.
from kivy import Config
from kivy.app import App
from kivy.lang import Builder
from kivy.properties import StringProperty
from kivy.uix.image import Image
from kivy.uix.screenmanager import ScreenManager, Screen, FadeTransition
from kivymd.app import MDApp
from kivy.uix.boxlayout import BoxLayout
from kivymd.theming import ThemableBehavior
from kivymd.uix.navigationdrawer import MDNavigationLayout, MDNavigationDrawer
from kivymd.uix.list import MDList, OneLineAvatarListItem, ILeftBody
from kivy.properties import ObjectProperty
from kivy.uix.widget import Widget
Config.set('input', 'mouse', 'mouse,disable_multitouch')
class DrawerList(ThemableBehavior, MDList, Screen):
pass
class NavLayout(MDNavigationLayout):
pass
class Login(Screen):
nav_drawer = ObjectProperty()
class Nav(Screen):
Login = ObjectProperty()
ScreenManager = ObjectProperty
class Homepage(Screen):
Login = ObjectProperty()
nav_drawer = ObjectProperty()
class AddNewCustomer(Screen):
nav_drawer = ObjectProperty()
class AddNewStaff(Screen):
pass
class ScreenManager(ScreenManager):
Login = ObjectProperty()
class ContentNavigationDrawer(BoxLayout):
pass
class MainApp(MDApp):
def build(self):
# Window.maximize()
# self.theme_cls.theme_style = "Light"
# self.theme_cls.primary_hue = "900"
login = Builder.load_file("login.kv")
return login
if __name__ == "__main__":
MainApp().run()
ScreenManager:
Login:
Homepage:
AddNewCustomer:
Nav:
DrawerList:
<Login>:
name: "login"
MDCard:
size_hint: None, None
size: 700, 800
pos_hint: {"center_x": 0.5, "center_y": 0.5}
elevation: 10
padding: 25
spacing: 25
orientation: 'vertical'
Image:
source: 'images/asteria.png'
size: 100, 200
MDLabel:
id: login
font_size: 40
halign: 'center'
size_hint_y: None
height: self.texture_size[1]
padding_y: 15
MDTextFieldRound:
id: user
hint_text: "username"
icon_right: "account"
size_hint_x: None
width: 200
font_size: 18
pos_hint: {"center_x": 0.5}
MDTextFieldRound:
id: password
hint_text: "password"
icon_right: "eye-off"
size_hint_x: None
width: 200
font_size: 18
pos_hint: {"center_x": 0.5}
password: True
MDRoundFlatButton:
text: "LOGIN"
font_size: 12
pos_hint: {"center_x": 0.5}
on_release:
root.manager.current = "homepage"
root.manager.transition.direction = "left"
MDRoundFlatButton:
text: "CLEAR"
font_size: 12
pos_hint: {"center_x": 0.5}
on_press: app.clear()
Widget:
size_hint_y: None
height: 50
<Nav>:
ScrollView:
MDList:
OneLineListItem:
text: "Add New Customer"
on_release:
root.nav_drawer.set_state("close")
root.screen_manager.current = "addNewCustomer"
root.screen_manager.transition.direction = "right"
OneLineListItem:
text: "Add New Staff"
font_size: 15
halign: "center"
on_release:
root.nav_drawer.set_state("close")
root.screen_manager.current = "addNewStaff"
OneLineListItem:
text: "Case List"
font_size: 15
halign: "center"
on_release:
root.nav_drawer.set_state("close")
root.screen_manager.current = "caseList"
OneLineListItem:
text: "Create Case"
font_size: 15
halign: "center"
on_release:
root.nav_drawer.set_state("close")
root.screen_manager.transition.direction = "left"
root.screen_manager.current = "Create Case"
OneLineListItem:
text: "Log Out"
font_size: 15
halign: "center"
on_release:
root.nav_drawer.set_state("close")
root.manager.current = "login"
root.manager.transition.direction = "right"
<Homepage>:
name: "homepage"
Screen:
BoxLayout:
orientation: 'vertical'
MDToolbar:
title: 'Navigation'
left_action_items: [['menu', lambda x: nav_drawer.set_state('toggle')]]
right_action_items: [["images/asteria.png", lambda x: None]]
elevation:5
Widget:
MDNavigationDrawer:
id: nav_drawer
Nav:
screen_manager: screen_manager
nav_drawer: nav_drawer
manager: root.manager
MDNavigationLayout:
ScreenManager:
id: screen_manager
Screen:
name: "Homepage"
MDLabel:
text: "Welcome Home"
halign: "center"
Screen:
name: "addNewCustomer"
MDLabel:
text: "Add New customer"
halign: "center"
Screen:
name: "addNewStaff"
MDLabel:
text: "Add New Staff"
halign: "center"
Screen:
name: "caseList"
MDLabel:
text: "Case List"
halign: "center"
Screen:
name: "casePool"
MDLabel:
text: "Case Pool"
halign: "center"
Screen:
name: "Create Case"
MDTextFieldRound:
id: user
hint_text: "Case Title"
icon_right: "Case Title"
size_hint_x: None
width: 275
font_size: 15
pos_hint: {"top": 0.875, "center_x": 0.155}
MDTextFieldRound:
id: user2
hint_text: "e.g. Matthew Inwards School of Swag"
mode:"rectangle"
icon_right: "Customer"
size_hint_x: None
width: 275
font_size: 14
pos_hint: {"top": 0.779, "center_x": 0.155}
Change the position of the navigation bar in the homepage:
ScreenManager:
Login:
Homepage:
AddNewCustomer:
Nav:
DrawerList:
<Login>:
name: "login"
MDCard:
size_hint: None, None
size: 700, 800
pos_hint: {"center_x": 0.5, "center_y": 0.5}
elevation: 10
padding: 25
spacing: 25
orientation: 'vertical'
Image:
source: 'images/asteria.png'
size: 100, 200
MDLabel:
id: login
font_size: 40
halign: 'center'
size_hint_y: None
height: self.texture_size[1]
padding_y: 15
MDTextFieldRound:
id: user
hint_text: "username"
icon_right: "account"
size_hint_x: None
width: 200
font_size: 18
pos_hint: {"center_x": 0.5}
MDTextFieldRound:
id: password
hint_text: "password"
icon_right: "eye-off"
size_hint_x: None
width: 200
font_size: 18
pos_hint: {"center_x": 0.5}
password: True
MDRoundFlatButton:
text: "LOGIN"
font_size: 12
pos_hint: {"center_x": 0.5}
on_release:
root.manager.current = "homepage"
root.manager.transition.direction = "left"
MDRoundFlatButton:
text: "CLEAR"
font_size: 12
pos_hint: {"center_x": 0.5}
on_press: app.clear()
Widget:
size_hint_y: None
height: 50
<Nav>:
ScrollView:
MDList:
OneLineListItem:
text: "Add New Customer"
on_release:
root.nav_drawer.set_state("close")
root.screen_manager.current = "addNewCustomer"
root.screen_manager.transition.direction = "right"
OneLineListItem:
text: "Add New Staff"
font_size: 15
halign: "center"
on_release:
root.nav_drawer.set_state("close")
root.screen_manager.current = "addNewStaff"
OneLineListItem:
text: "Case List"
font_size: 15
halign: "center"
on_release:
root.nav_drawer.set_state("close")
root.screen_manager.current = "caseList"
OneLineListItem:
text: "Create Case"
font_size: 15
halign: "center"
on_release:
root.nav_drawer.set_state("close")
root.screen_manager.transition.direction = "left"
root.screen_manager.current = "Create Case"
OneLineListItem:
text: "Log Out"
font_size: 15
halign: "center"
on_release:
root.nav_drawer.set_state("close")
root.manager.current = "login"
root.manager.transition.direction = "right"
<Homepage>:
name: "homepage"
Screen:
MDNavigationLayout:
ScreenManager:
id: screen_manager
Screen:
name: "Homepage"
MDLabel:
text: "Welcome Home"
halign: "center"
Screen:
name: "addNewCustomer"
MDLabel:
text: "Add New customer"
halign: "center"
Screen:
name: "addNewStaff"
MDLabel:
text: "Add New Staff"
halign: "center"
Screen:
name: "caseList"
MDLabel:
text: "Case List"
halign: "center"
Screen:
name: "casePool"
MDLabel:
text: "Case Pool"
halign: "center"
Screen:
name: "Create Case"
MDTextFieldRound:
id: user
hint_text: "Case Title"
icon_right: "Case Title"
size_hint_x: None
width: 275
font_size: 15
pos_hint: {"top": 0.875, "center_x": 0.155}
MDTextFieldRound:
id: user2
hint_text: "e.g. Matthew Inwards School of Swag"
mode:"rectangle"
icon_right: "Customer"
size_hint_x: None
width: 275
font_size: 14
pos_hint: {"top": 0.779, "center_x": 0.155}
BoxLayout:
orientation: 'vertical'
MDToolbar:
title: 'Navigation'
left_action_items: [['menu', lambda x: nav_drawer.set_state('open')]]
right_action_items: [["images/asteria.png", lambda x: None]]
elevation:5
Widget:
MDNavigationDrawer:
id: nav_drawer
Nav:
screen_manager: screen_manager
nav_drawer: nav_drawer
manager: root.manager

Create a recycle view(Gridlayout) inside a Boxlayout kivy

I need all the elements of my FirsWindow, put them in a recycleview. I'm thinking to do it from RecycleGridLayout instead of GridLayout, but I don't how to really apply it in the code. It's necesary that the GridLayout or RecycleGridLayout have cols:4, I think it's not necessary upload my py.file but I'm not sure. please I need help on this. thanks in advance.
kv.file
<FirstWindow>:
name: "Catalogue"
BoxLayout:
id: Boxmain
orientation: "vertical"
#size: root.width, root.height
#size_hint: 1, None
#height: 300
#padding: 50
spacing: 50
size: root.height, root.width
GridLayout:
cols: 4
padding: 4
Label:
text: "Items"
#font_size: 25
Label:
text: "Number"
Label:
text: "Price"
Label:
text: "Add to Cart"
Label:
text: "Tornillos"
text_size: self.size
halign: 'center'
valign: 'bottom'
Image:
id: image_tornillos
allow_stretch: True
keep_ratio: True
size_hint: 0.2,0.2
width: 60
height: 80
#pos_hint: {'center_x':1, 'center_y':1}
source: "images/tornillo.png"
center_x: self.parent.center_x
center_y: self.parent.center_y+10
TextInput:
id: input_tornillo
text: ""
halign: "right"
font_size: 18
multiline: True
#size_hint: (1, .15)
Label:
text: "0.0"
Button:
id: shopping1
#text: "Hello"
#font_size: 32
allow_stretch: True
keep_ratio: True
size_hint: .25,.30
pos_hint: {'center_x':0.5, 'center_y':0.5}
background_color: 0,0,0,0
#on_press: root.press_on()
#on_release: root.press_off()
on_press: root.ids.Shoppingcart1.source= root.var2
on_release: root.ids.Shoppingcart1.source= root.var1
Image:
id: Shoppingcart1
allow_stretch: True
keep_ratio: True
size_hint: 0.5,0.5
width: 60
height: 60
pos_hint: {'center_x':0.5, 'center_y':0.5}
source: root.var1
center_x: self.parent.center_x
center_y: self.parent.center_y
#------------------------
Button:
text:"lala"
Button:
text:"lal2"
Button:
text:"lale"
Button:
text:"lal5"
Button:
text:"lala"
Button:
text:"lal54"
Button:
text:"lala"
#------------------------------------------------------------

Change mouse pointer to 'hand' when hovering over a button of a screen in kivy Python

How can I change the mouse pointer to 'hand' when hovering over a button present in a screen along with a different widget in kivy python?
I tried creating two functions in a python file. But it changes the mouse cursor for the entire page. How can I change the cursor for just the button present on the page?
#Kivy design file
<Loginpage>:
name: "login"
Image:
source: 'background.jpg'
allow_stretch: True
keep_ratio: False
Screen:
MDCard:
size_hint: None,None
size: 400, 550
pos_hint: {"center_x":0.5,"center_y":0.5}
elevation: 10
padding: 25
spacing: 25
orientation: 'vertical'
MDLabel:
id: welcome_label
text: "Welcome"
font_size: 40
halign: 'center'
size_hint_y: None
height: self.texture_size[1]
padding_y:15
font_style: 'H2'
MDTextField:
id: uid
hint_text: "Username"
icon_right: "account"
size_hint_x: None
width: 200
font_size: 20
pos_hint: {"center_x": 0.5}
MDTextField:
id: pwd
hint_text: "Password"
icon_right: "lock"
size_hint_x: None
width: 200
font_size: 20
pos_hint: {"center_x": 0.5}
password: True
MDRoundFlatButton:
text: "LOG IN"
font_size: 12
pos_hint: {"center_x": 0.5}
on_press: root.logger()
MDRoundFlatButton:
text: "CLEAR"
font_size: 12
pos_hint: {"center_x": 0.5}
on_press: root.clear()
MDLabel:
id: login_label
text: "Invalid Login"
font_size: 14
halign: 'center'
size_hint_y: None
height: self.texture_size[1]
pos_hint: {"center_x": 0.5}
padding_y:15
theme_text_color:'Custom'
text_color: 1,0,0,1
Widget:
size_hint_y: None
height: 10
Python File:
class Loginpage(Screen):
def enter(self, *args):
Window.set_system_cursor('hand')
class Loginpage(Screen):
def enter(self, *args):
Window.set_system_cursor('hand')
def leave(self, *args):
Window.set_system_cursor('arrow')
def logger(self):
'''code to login'''

Prevent KivyMD from drawing a widget several times

I am currently building a mobile app with Python and KivyMD. On my application I have an MDExpansionPanel which is called in the on_pre_enter method of the ScreenManager. Naturally this will cause that every time I enter to the same page, the widget will be drawn once again.
Is there a way to delete the previous widget before drawing the new one? I've tried several approaches however I have had no success.
The code for a minimal reproducible example is the following:
Python code:
from kivy.properties import ObjectProperty
from kivy.uix.screenmanager import ScreenManager, Screen
from kivymd.app import MDApp
from kivymd.uix.expansionpanel import MDExpansionPanel, MDExpansionPanelOneLine
from kivy.uix.boxlayout import BoxLayout
class MyContentAliment(BoxLayout):
pass
class MyContentCasetas(BoxLayout):
pass
class MyContentGasolina(BoxLayout):
pass
class MyContentHosped(BoxLayout):
pass
class MyContentVarios(BoxLayout):
pass
class LoginWindow(Screen):
pass
class TravelManagerWindow(Screen):
panel_container = ObjectProperty(None)
# EXPANSION PANEL PARA SOLICITAR GV
def set_expansion_panel(self):
# FOOD PANEL
self.ids.panel_container.add_widget(MDExpansionPanel(icon="food", content=MyContentAliment(),
panel_cls=MDExpansionPanelOneLine(text="Alimentacion")))
# CASETAS PANEL
self.ids.panel_container.add_widget(MDExpansionPanel(icon="food", content=MyContentCasetas(),
panel_cls=MDExpansionPanelOneLine(text="Casetas")))
# GAS PANEL
self.ids.panel_container.add_widget(MDExpansionPanel(icon="food", content=MyContentGasolina(),
panel_cls=MDExpansionPanelOneLine(text="Gasolina")))
# HOSPEDAJE PANEL
self.ids.panel_container.add_widget(MDExpansionPanel(icon="food", content=MyContentHosped(),
panel_cls=MDExpansionPanelOneLine(text="Hospedaje")))
# VARIOS PANEL
self.ids.panel_container.add_widget(MDExpansionPanel(icon="food", content=MyContentVarios(),
panel_cls=MDExpansionPanelOneLine(text="Varios")))
### WINDOW MANAGER ################################
class WindowManager(ScreenManager):
pass
ScreenManager().add_widget(LoginWindow(name='login'))
ScreenManager().add_widget(TravelManagerWindow(name='travelManager'))
class reprodExample(MDApp):
def build(self):
self.theme_cls.primary_palette = "Teal"
return WindowManager()
if __name__ == "__main__":
reprodExample().run()
Kivy code:
:
LoginWindow:
TravelManagerWindow:
<LoginWindow>:
name: 'login'
MDRaisedButton:
text: 'Enter'
pos_hint: {'center_x': 0.5, 'center_y': 0.5}
size_hint: None, None
on_release:
root.manager.transition.direction = 'up'
root.manager.current = 'travelManager'
<TravelManagerWindow>:
name:'travelManager'
on_pre_enter: root.set_expansion_panel()
MDRaisedButton:
text: 'Back'
pos_hint: {'center_x': 0.5, 'center_y': 0.85}
size_hint: None, None
on_release:
root.manager.transition.direction = 'down'
root.manager.current = 'login'
BoxLayout:
orientation: 'vertical'
size_hint:1,0.85
pos_hint: {"center_x": 0.5, "center_y":0.37}
adaptive_height:True
height: self.minimum_height
ScrollView:
adaptive_height:True
GridLayout:
size_hint_y: None
cols: 1
row_default_height: root.height*0.10
height: self.minimum_height
BoxLayout:
adaptive_height: True
orientation: 'horizontal'
GridLayout:
id: panel_container
size_hint_x: 0.6
cols: 1
adaptive_height: True
BoxLayout:
size_hint_x: 0.05
MDCard:
id: resumen_solicitud
size_hint: None, None
size: "250dp", "300dp"
pos_hint: {"top": 0.9, "center_x": .5}
elevation: 0.1
MDBoxLayout:
orientation: 'vertical'
canvas.before:
Color:
rgba: 0.8, 0.8, 0.8, 1
Rectangle:
pos: self.pos
size: self.size
MDLabel:
text: 'Monto Total Solicitado'
font_style: 'Button'
halign: 'center'
font_size: (root.width**2 + root.height**2) / 15.5**4
size_hint_y: 0.2
MDSeparator:
height: "1dp"
MDTextField:
id: suma_solic_viaje
text: "$ 0.00"
bold: True
line_color_normal: app.theme_cls.primary_color
halign: "center"
size_hint_x: 0.8
pos_hint: {'center_x': 0.5, 'center_y': 0.5}
MDSeparator:
height: "1dp"
BoxLayout:
id: expense_graph
halign: 'center'
<MyContentAliment>:
adaptive_height: True
MDBoxLayout:
orientation:'horizontal'
adaptive_height:True
size_hint_x:self.width
pos_hint: {"center_x":0.5, "center_y":0.5}
spacing: dp(10)
padding_horizontal: dp(10)
MDLabel:
text: 'Monto:'
multiline: 'True'
halign: 'center'
pos_hint: {"x":0, "top":0.5}
size_hint_x: 0.15
font_style: 'Button'
font_size: 19
MDTextField:
id: monto_aliment_viaje
hint_text: 'Monto a solicitar'
pos_hint: {"x":0, "top":0.5}
halign: 'left'
size_hint_x: 0.3
helper_text: 'Ingresar el monto a solicitar'
helper_text_mode: 'on_focus'
write_tab: False
required: True
MDRaisedButton:
id: boton_aliment_viaje
pos_hint: {"x":0, "top":0.5}
text:'Ingresar Gasto'
### CASETAS
<MyContentCasetas>:
adaptive_height: True
MDBoxLayout:
orientation:'horizontal'
adaptive_height:True
size_hint_x:self.width
pos_hint: {"center_x":0.5, "center_y":0.5}
spacing: dp(10)
padding_horizontal: dp(10)
MDLabel:
text: 'Monto:'
multiline: 'True'
halign: 'center'
pos_hint: {"x":0, "top":0.5}
size_hint_x: 0.15
font_style: 'Button'
font_size: 19
MDTextField:
id: monto_casetas_viaje
hint_text: 'Monto a solicitar'
pos_hint: {"x":0, "top":0.5}
halign: 'left'
size_hint_x: 0.3
helper_text: 'Ingresar el monto a solicitar'
helper_text_mode: 'on_focus'
write_tab: False
input_filter: 'float'
required: True
MDRaisedButton:
id: boton_casetas_viaje
pos_hint: {"x":0, "top":0.5}
text:'Ingresar Gasto'
BoxLayout:
size_hint_x: 0.05
### GASOLINA
<MyContentGasolina>:
adaptive_height: True
MDBoxLayout:
orientation:'horizontal'
adaptive_height:True
size_hint_x:self.width
pos_hint: {"center_x":0.5, "center_y":0.5}
spacing: dp(10)
padding_horizontal: dp(10)
MDLabel:
text: 'Monto:'
multiline: 'True'
halign: 'center'
pos_hint: {"x":0, "top":0.5}
size_hint_x: 0.15
font_style: 'Button'
font_size: 19
MDTextField:
id: monto_gas_viaje
hint_text: 'Monto a solicitar'
pos_hint: {"x":0, "top":0.5}
halign: 'left'
size_hint_x: 0.3
helper_text: 'Ingresar el monto a solicitar'
helper_text_mode: 'on_focus'
write_tab: False
input_filter: 'float'
required: True
MDRaisedButton:
id: boton_gas_viaje
pos_hint: {"x":0, "top":0.5}
text:'Ingresar Gasto'
BoxLayout:
size_hint_x: 0.05
Thanks a lot in advance.

Kivy grouped checkboxes (radio buttons) all clicking together, and from anywhere on the screen?

Here is what I thought was a very simple screen config, and I get three radio buttons. But clicking anywhere on the screen results in the third radio button selecting - you cannot select first or second radio button, and why does it select when the user clicks anywhere on the screen instead of just on the radio button? Clicking anywhere a second time unselects the third item.
<FirstProfile>
id: firstprofile
disc_1: disc_1
disc_2: disc_2
disc_3: disc_3
canvas.before:
Color:
rgba: 1,1,1,1
Rectangle:
size: self.size
FloatLayout:
CheckBox:
id: disc_1
pos_hint: {'x':0.05,'center_y':0.7}
group: "disc"
active: False
Label:
text: "Disc 1"
pos_hint: {'x':0.25,'center_y':0.7}
text_size: 200,80
halign: 'left'
valign: 'middle'
CheckBox:
id: disc_2
pos_hint: {'x':0.05,'center_y':0.65}
group: "disc"
active: False
Label:
text: "Disc 2"
pos_hint: {'x':0.25,'center_y':0.65}
text_size: 200,80
halign: 'left'
valign: 'middle'
CheckBox:
id: disc_3
pos_hint: {'x':0.05,'center_y':0.6}
group: "disc"
active: False
Label:
text: "Disc 3"
pos_hint: {'x':0.25,'center_y':0.6}
text_size: 200,80
halign: 'left'
valign: 'middle'
The problem is that you have not set any sizes for the CheckBoxes, so each CheckBox gets assigned the default size_hint of (1,1), meaning each one is the same size as their parent FloatLayout. When you click anywhere on that FloatLayout, the last CheckBox added ("Disc 3") gets the event and claims it for itself, and the others never see the event.
Here is a modified version of your kv that sets some sizes:
<FirstProfile>
id: firstprofile
disc_1: disc_1
disc_2: disc_2
disc_3: disc_3
FloatLayout:
CheckBox:
id: disc_1
pos_hint: {'x':0.05,'center_y':0.7}
group: "disc"
active: False
size_hint: None, None
size: sp(32), sp(32)
Label:
text: "Disc 1"
pos_hint: {'x':0.25,'center_y':0.7}
text_size: 200,80
halign: 'left'
valign: 'middle'
size_hint: None, None
size: self.texture_size
CheckBox:
id: disc_2
pos_hint: {'x':0.05,'center_y':0.65}
group: "disc"
active: False
size_hint: None, None
size: sp(32), sp(32)
Label:
text: "Disc 2"
pos_hint: {'x':0.25,'center_y':0.65}
text_size: 200,80
halign: 'left'
valign: 'middle'
size_hint: None, None
size: self.texture_size
CheckBox:
id: disc_3
pos_hint: {'x':0.05,'center_y':0.6}
group: "disc"
active: False
size_hint: None, None
size: sp(32), sp(32)
Label:
text: "Disc 3"
pos_hint: {'x':0.25,'center_y':0.6}
text_size: 200,80
halign: 'left'
valign: 'middle'
size_hint: None, None
size: self.texture_size

Categories

Resources