ListItemButton - How to increase the height of button size?Hi

407 views
Skip to first unread message

Vijaykumar Walikar

unread,
Apr 17, 2016, 10:44:54 AM4/17/16
to Kivy users support

Hi All,

I am using ListItemButton in my code. But I am not able to change the size of list item button.
Please someone guide how to change the button size of ListItemButton.

Thank you!!!

Regards
Vijaykumar Walikar

ZenCODE

unread,
Apr 17, 2016, 1:40:00 PM4/17/16
to Kivy users support
Have you tried setting the 'size_hint_y' property to None, and the 'height' to '40', or whatever you want it to be? Setting the 'size_hint_y' to None is important when using many many of the layouts.

Vijaykumar Walikar

unread,
Apr 18, 2016, 5:14:04 AM4/18/16
to Kivy users support
Thank you for your reply Zencode.

Yes I did try using 'size_hint_y' and 'height', but unfortunately it is not changing button size of ListItemButton.

However I can change the color of button using 'selected_color' and 'deselected_color' but I don't find any property to change button size.

Regards
Vijay

Message has been deleted
Message has been deleted

ZenCODE

unread,
Apr 18, 2016, 5:10:11 PM4/18/16
to Kivy users support
Okay, listviews can be created many ways (simple lists, adaptors, etc), so it's hard to say. Have you tried setting the listview's row_height property?

Otherwise, please post a minimal example of the code so we can see exactly how you are creating you listview?

Peace out

Vijaykumar Walikar

unread,
Apr 19, 2016, 1:13:04 AM4/19/16
to Kivy users support

I am using adapters.
As per your suggestion, I tried setting row_height property of listview but still unsuccessful :(

Please find the example code as requested.

main.py
Test.kv
KivyQuestionOnListitembutton_2016Apr19.png

Jean-Paul Etourneau

unread,
Apr 22, 2016, 10:03:34 AM4/22/16
to Kivy users support
Hello,

See the the arg_converter system in the ListAdpter. See extract of my code :
        ## Init data adapter
        list_item_args_converter
= lambda row_index, obj: {'text': obj.text,
                                                           
'is_selected': obj.is_selected,
                                                           
'index' : obj.index,
                                                           
'type_transaction' : obj.type_transaction,
                                                           
'size_hint_y': None,
                                                           
'height': '150sp'}
       
        p__list_adapter
= ListAdapter(data=[],
                                      args_converter
=list_item_args_converter,
                                      selection_mode
='single',
                                      allow_empty_selection
=True,
                                     
template='TableurItem')


with it I can change the height to  '150sp'


With the arg_converter

Jonas Zimmermann

unread,
Apr 22, 2016, 10:08:12 AM4/22/16
to kivy-...@googlegroups.com
Maybe someone else can shed light on why adding

<ListItemButton>:
size: (100, 50)

to Vijaykumar’s example kv will affect the ListItemButton’s height but

<ListItemButton>:
height: 50

won’t.

I tried to find a clue in the code but was unsuccessful.

Jonas

Vijaykumar Walikar

unread,
May 1, 2016, 6:04:11 AM5/1/16
to Kivy users support

I could finally achieve this using args_converter as below.

args_converter = lambda row_index, row_data: {'text':row_data, 'size_hint_y': None, 'height': '48dp'}

Thank you all for your help!!!

Reply all
Reply to author
Forward
0 new messages