python - ActionPrevious getting an unexpected background -
i've made rule in kv button class have specific background (provided in image). when created actionbar contains actionprevious , actionbutton widgets, both seemed same background.
 , understand actionbutton instance got background, since inherits button , actionitem classes, why did actionprevious same background? inherits boxlayout , actionitem, neither of have button class. what's reason behind it?
also, side question
 actionprevious has property with_previous which, when set true, adds clickable arrow. however, title of widget remains unclickable. docs property make whole widget clickable. while it's not big deal, i'd rather want entire actionprevious widget background change on press. possible achieve this?
 mean when press arrow, space around , app icon turns blue, text doesn't, if it's part of different widget.
here code visualize question:
from kivy.base import runtouchapp kivy.lang import builder kivy.uix.actionbar import actionbar  builder.load_string(''' <button>:     background_normal: 'some_file.png'  <menubar>:     actionview:         actionprevious:             title: "log out"             with_previous: true         actionbutton:             text: "settings" ''') class menubar(actionbar):     pass  runtouchapp(menubar()) 
okay, truth in style.kv file. basically, actionprevious widget has following structure:
<actionprevious>:     gridlayout:         actionpreviousbutton:             gridlayout:                 actionpreviousimage:                     id: prev_icon_image  # "back" arrow                 actionpreviousimage:                     id: app_icon_image   # app icon                 widget:                     # perhaps split title gridlayout     label:         id: title                        # title  and actionpreviousbutton inherits button, that's why actionprevious arrow part getting background.
here lies answer side question. since clickable part actionpreviousbutton, , title kept in label, not child of it, text unclickable. fix that, 1 has create custom class , put label child of actionpreviousbutton.
Comments
Post a Comment