Tuesday, 15 September 2015

android - Kivy ScrollView+Accordion Error -


I have this code. If I increase the number of items that are filled with a certain amount, then the app is continuous. Grid layout version (commented) works as expected. The attacker area is here and there. Kivy.uix.spinner import spinner, kivy.uix.accordion import from kivy.uix.boxlayout Import boxLayout from SpinnerOption from kivy.app Accordion from import app, kivy.core.window import window Kivy.uix.gridlayout from class MusicController (application) import gridLayout from kivy.uix.scrollview import scrollview from kivy.uix.button import button from kivy.uix.label import label from AccordionItem: def (self): b = box layout (orientation) = 'Vertical') top = spinner (text = '12', value = ["song", "artist", "playlist", "search"], background_color = (.3, .2, .5,1) Size_hint_y = 0.1) # & lt; Here & gt; # Items = accordion (orientation = 'vertical') for x in xrange (30): items = AccordionItem (title = 'title% d'% x) button = BoxLayout () buttons.add_widget (button (text = 'play' ) Buttons.add_widget (button (text = 'stop')) buttons.add_widget (button (text = 'pause')) item.add_widget (buttons) items.add_widget (item) # ~ items = GridLayout (column = # 1 For, spaces = 10, size = hint_a = none) # ~ items. Bind (minimum_hite = item.Setter ('height')) # (# 30) for # range: # ~ btn = button (text = str (i) # & lt; there & gt; [["previous", "play" "," Next_playing.add_widget (button = text = Widget)) b.add_widget (above) b.add_widget (sv) b.add_widget (now_playing) return b if __name__ == '__main__':: MusicController () run ()

As you suggest an error on the console

  [warning] [Accordion] There is not enough room for children to show [W ARNING] [Accordion] XXXX, XXXXpx found [Warning] [Accordion] layout was canceled.   

Just Accordian Increase the given space so that it can keep all children

changing the line of your code

  items = equine (orientation = 'vertical', size_hint_a = None, height = 50 * 30)   

should work.

In the grid layout, you do this by binding, the height of the gridlove's minimum_height (which is calculated by the height of children).

Accordian does not have any such feature, so you have to do it yourself.

To make it more dynamic, you can stay connected to children's property such as Accordion:

  item.bind (children = self.update_size)  < Then define update_size such as:  
  def Update_size (self, example, value): #Type # 50 for what you want the height of your AccordionItem Size = 50 * lane (example. Smallpox)    

No comments:

Post a Comment