user interface - how to use scrollbar in kivy python -


can tell me how use scrollbar in code? , secondly, there way align labels , textinput text inside textinput visible no matter how input there. here alignment means: if there 100s(hundreds or thousands) of textinputs , text inside textinput should visible. when giving (spacing = 50) in code, after 20s input, text not visible properly. in advance.

from kivy.app import app kivy.uix.tabbedpanel import tabbedpanel kivy.uix.boxlayout import boxlayout kivy.properties import stringproperty kivy.uix.textinput import textinput kivy.uix.checkbox import checkbox kivy.lang import builder  rows = ['goc', 'coc', 'eee', 'abs' , 'kju' , 'iop' , 'nmg', 'gty', 'jkio', 'dbkgcd' , 'udbcbjkb']  builder.load_string("""  <test>:     do_default_tab: false      tabbedpanelitem:         text: 'page1'          table:             padding: 50, 50, 50, 50             orientation: 'vertical'  <row>:     spacing: 50     size_hint_x: 1     txt: txtinpt.text     label:         text: root.txt     textinput:         id: txtinpt         text: root.txt         disabled: not checkbox.active     checkbox:         id:checkbox          text: 'checkbox'         active: false     button:         text: 'save'  """) class table(boxlayout):     def __init__(self, **kwargs):         super(table, self).__init__(**kwargs)         row in rows:             self.add_widget(row(row))    class row(boxlayout):     txt = stringproperty()     def __init__(self, row, **kwargs):         super(row, self).__init__(**kwargs)         self.txt = row    class test(tabbedpanel):     pass  class myapp(app):      def build(self):         test = test()         return test   if __name__ == '__main__':     myapp().run() 

kivy scrollbar

the steps follow are:

  1. add scrollview tabbedpanelitem , put table inside it.
  2. prevent boxlayout (table) automatically adapting height height of parent widget using size_hint_y = none.
  3. specify row height.

the code be:

from kivy.app import app kivy.uix.tabbedpanel import tabbedpanel kivy.uix.boxlayout import boxlayout kivy.properties import stringproperty kivy.uix.textinput import textinput kivy.uix.checkbox import checkbox kivy.lang import builder  rows = ['goc', 'coc', 'eee', 'abs' , 'kju' , 'iop' , 'nmg', 'gty', 'jkio', 'dbkgcd' , 'udbcbjkb']  builder.load_string("""  <test>:     do_default_tab: false      tabbedpanelitem:         text: 'page1'          scrollview:             table:                 orientation: "vertical"                 size_hint_y: none                 height: self.minimum_height                 padding: 50, 50, 50, 50   <row>:     spacing: 50     size_hint_y: none     size_hint_x: 1     height: 100     txt: txtinpt.text     label:         text: root.txt      textinput:         id: txtinpt         text: root.txt         disabled: not checkbox.active     checkbox:         id:checkbox          text: 'checkbox'         active: false     button:         text: 'save'  """) class table(boxlayout):     def __init__(self, **kwargs):         super(table, self).__init__(**kwargs)         row in rows:             self.add_widget(row(row))    class row(boxlayout):     txt = stringproperty()     def __init__(self, row, **kwargs):         super(row, self).__init__(**kwargs)         self.txt = row   class test(tabbedpanel):     pass  class myapp(app):      def build(self):         test = test()         return test   if __name__ == '__main__':     myapp().run() 

note: modifications affect kv file.

output: enter image description here


Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -