<small id='ZjfMt'></small><noframes id='ZjfMt'>

  • <legend id='ZjfMt'><style id='ZjfMt'><dir id='ZjfMt'><q id='ZjfMt'></q></dir></style></legend>
      • <bdo id='ZjfMt'></bdo><ul id='ZjfMt'></ul>

        <tfoot id='ZjfMt'></tfoot>
        <i id='ZjfMt'><tr id='ZjfMt'><dt id='ZjfMt'><q id='ZjfMt'><span id='ZjfMt'><b id='ZjfMt'><form id='ZjfMt'><ins id='ZjfMt'></ins><ul id='ZjfMt'></ul><sub id='ZjfMt'></sub></form><legend id='ZjfMt'></legend><bdo id='ZjfMt'><pre id='ZjfMt'><center id='ZjfMt'></center></pre></bdo></b><th id='ZjfMt'></th></span></q></dt></tr></i><div id='ZjfMt'><tfoot id='ZjfMt'></tfoot><dl id='ZjfMt'><fieldset id='ZjfMt'></fieldset></dl></div>

        如何在 Kivy python 中最大化滚动条?

        时间:2023-10-09

      1. <small id='qnZ3E'></small><noframes id='qnZ3E'>

            <tbody id='qnZ3E'></tbody>

          1. <i id='qnZ3E'><tr id='qnZ3E'><dt id='qnZ3E'><q id='qnZ3E'><span id='qnZ3E'><b id='qnZ3E'><form id='qnZ3E'><ins id='qnZ3E'></ins><ul id='qnZ3E'></ul><sub id='qnZ3E'></sub></form><legend id='qnZ3E'></legend><bdo id='qnZ3E'><pre id='qnZ3E'><center id='qnZ3E'></center></pre></bdo></b><th id='qnZ3E'></th></span></q></dt></tr></i><div id='qnZ3E'><tfoot id='qnZ3E'></tfoot><dl id='qnZ3E'><fieldset id='qnZ3E'></fieldset></dl></div>
              <tfoot id='qnZ3E'></tfoot>

                <bdo id='qnZ3E'></bdo><ul id='qnZ3E'></ul>
                <legend id='qnZ3E'><style id='qnZ3E'><dir id='qnZ3E'><q id='qnZ3E'></q></dir></style></legend>

                  本文介绍了如何在 Kivy python 中最大化滚动条?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我在 kivy 中使用 multiTab.如何放大滚动条,以便鼠标可以移动(up_down)滚动条.我正在使用 BoxLayout 和 RecycleView.下面的代码使用的是 gridLayout,但不在 BoxLayout 中:

                  I am using multiTab in kivy. How to enlarge the scrollbar so that scrollbar can be moved(up_down) by mouse. I am using BoxLayout and RecycleView. The code below was working with gridLayout, but not in BoxLayout:

                  layout.bind(minimum_height=layout.setter('height'))
                  

                  推荐答案

                  这是一个如何扩展 ScrollView 以获得可拖动滑块的示例.

                  Here is an example of how to extend ScrollView to also get a dragable slider.

                  from kivy.app import App
                  from kivy.uix.boxlayout import BoxLayout
                  from kivy.lang import Builder
                  from kivy.uix.label import Label
                  
                  Builder.load_string("""
                  <ScrollSlider>:
                      ScrollView:
                          id: scrlvw
                          bar_width: 0
                          GridLayout:
                              id: grid
                              size_hint_y:None
                              cols:1
                              height: self.minimum_height
                              scroll_y: slider.value
                              on_touch_move: slider.value = self.scroll_y
                      Slider:
                          size_hint_x: None
                          width: root.width*0.2
                          id: slider
                          min: 0
                          max: 1
                          orientation: 'vertical'
                          value: scrlvw.scroll_y
                          on_value: scrlvw.scroll_y = self.value
                  
                  """)
                  
                  
                  class ScrollSlider(BoxLayout):
                  
                      def custom_add(self, widget):
                          self.ids.grid.add_widget(widget)
                  
                  class MyApp(App):
                  
                  
                      def build(self):
                          scrollslider = ScrollSlider()
                          for i in range(1, 100):
                              scrollslider.custom_add(Label(text=str(i), height=100, size_hint_y=None))
                          return scrollslider
                  
                  if __name__ == '__main__':
                      MyApp().run()
                  

                  你需要使用custom_addScrollSlider中添加widget或者在kivy中添加到GridLayout中.

                  You need to use the custom_add to add widgets in the ScrollSlider or add them to the GridLayout in kivy.

                  我从@Edvardas Dlugauskas 提供的链接中获得了一些灵感.

                  I took some inspiration from the link @Edvardas Dlugauskas provided.

                  您提供的代码不适用于 BoxLayout,因为 BoxLayout 只占用其父级的大小.为了能够滚动,您需要将 sth 添加到比 ScrollView 本身大的 ScrollView 中.

                  The code you provided does not work with BoxLayout because BoxLayout just takes the size of its parent. To be able to scroll you need to add sth into ScrollView which is larger than the ScrollView itself.

                  这篇关于如何在 Kivy python 中最大化滚动条?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:Kivy 窗口隐藏/显示 下一篇:如何在 kivy python 中使用滚动条

                  相关文章

                  最新文章

                1. <legend id='ErHr0'><style id='ErHr0'><dir id='ErHr0'><q id='ErHr0'></q></dir></style></legend>
                2. <small id='ErHr0'></small><noframes id='ErHr0'>

                    <bdo id='ErHr0'></bdo><ul id='ErHr0'></ul>

                    <tfoot id='ErHr0'></tfoot>

                    1. <i id='ErHr0'><tr id='ErHr0'><dt id='ErHr0'><q id='ErHr0'><span id='ErHr0'><b id='ErHr0'><form id='ErHr0'><ins id='ErHr0'></ins><ul id='ErHr0'></ul><sub id='ErHr0'></sub></form><legend id='ErHr0'></legend><bdo id='ErHr0'><pre id='ErHr0'><center id='ErHr0'></center></pre></bdo></b><th id='ErHr0'></th></span></q></dt></tr></i><div id='ErHr0'><tfoot id='ErHr0'></tfoot><dl id='ErHr0'><fieldset id='ErHr0'></fieldset></dl></div>