<legend id='NsOGz'><style id='NsOGz'><dir id='NsOGz'><q id='NsOGz'></q></dir></style></legend>

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

      • <bdo id='NsOGz'></bdo><ul id='NsOGz'></ul>

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

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

      how to maximize scrollbar in Kivy python?(如何在 Kivy python 中最大化滚动条?)
    1. <small id='EncS1'></small><noframes id='EncS1'>

        <legend id='EncS1'><style id='EncS1'><dir id='EncS1'><q id='EncS1'></q></dir></style></legend>
              <tbody id='EncS1'></tbody>
              <bdo id='EncS1'></bdo><ul id='EncS1'></ul>
              <tfoot id='EncS1'></tfoot>

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

                本文介绍了如何在 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 中最大化滚动条?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Kivy 1.9.0 Windows package KeyError: #39;rthooks#39;(Kivy 1.9.0 Windows 包 KeyError: rthooks)
                Python Kivy: how to call a function on button click?(Python Kivy:如何在按钮单击时调用函数?)
                How to disable a widget in Kivy?(如何禁用 Kivy 中的小部件?)
                Centering an object in Kivy(在 Kivy 中将对象居中)
                How to downgrade to Python 3.4 from 3.5(如何从 Python 3.5 降级到 Python 3.4)
                Change button or label text color in kivy(在kivy中更改按钮或标签文本颜色)
                  <tfoot id='L1yg9'></tfoot>
                • <legend id='L1yg9'><style id='L1yg9'><dir id='L1yg9'><q id='L1yg9'></q></dir></style></legend>
                • <small id='L1yg9'></small><noframes id='L1yg9'>

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

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

                            <tbody id='L1yg9'></tbody>