pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

  • <legend id='9Asbp'><style id='9Asbp'><dir id='9Asbp'><q id='9Asbp'></q></dir></style></legend>
    <i id='9Asbp'><tr id='9Asbp'><dt id='9Asbp'><q id='9Asbp'><span id='9Asbp'><b id='9Asbp'><form id='9Asbp'><ins id='9Asbp'></ins><ul id='9Asbp'></ul><sub id='9Asbp'></sub></form><legend id='9Asbp'></legend><bdo id='9Asbp'><pre id='9Asbp'><center id='9Asbp'></center></pre></bdo></b><th id='9Asbp'></th></span></q></dt></tr></i><div class="o4igaam" id='9Asbp'><tfoot id='9Asbp'></tfoot><dl id='9Asbp'><fieldset id='9Asbp'></fieldset></dl></div>

      <small id='9Asbp'></small><noframes id='9Asbp'>

    1. <tfoot id='9Asbp'></tfoot>
        <bdo id='9Asbp'></bdo><ul id='9Asbp'></ul>

        ScrollView 小部件在 kivy 中不滾動

        ScrollView widget not scolling in kivy(ScrollView 小部件在 kivy 中不滾動)

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

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

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

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

                • 本文介紹了ScrollView 小部件在 kivy 中不滾動的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我在嘗試使動態生成的標簽堆棧可滾動時遇到一些問題.我可能誤解了應該使用 ScrollView 的方式,所以我希望有人可以為我澄清一下.下面的代碼從一個csv中讀取一堆數據,當那個代碼顯示出來的時候,如果有很多數據,程序基本上會嘗試把所有的text/Labels壓縮到GridLayout中.我希望數據可以滾動.這是代碼的抽象版本:

                  I'm having some issues using the ScollView Widget in an attempt to make a dynamically-generated stack of labels scrollable. It's possible that I'm misunderstanding the way ScrollView should be utilized, so I'm hoping somebody could clarify it for me. The following code reads a bunch of data from a csv, and when that code is displayed, if there is a lot of data, the program will basically try to compress all the text/Labels into the GridLayout. I'd like the data to be scrollable. Here's an abstracted version of the code:

                  class showData(Screen):
                  def __init__(self, **kwargs):
                      super(showData, self).__init__(**kwargs)
                  
                      self.my_data = read_csv_to_dict()
                      self.data_exists = 0 if len(self.my_data) == 0 else 1 
                  
                      ### Create Widgets ###      
                      layout_main = BoxLayout(orientation = 'vertical')
                      layout_back_button = BoxLayout(padding = [0, 0, 0, 20])
                      self.layout_data = GridLayout(cols = 3 if self.data_exists else 1)  
                      self.scrollview_data = ScrollView()
                  
                      button_back = Button(text = 'Main menu')
                  
                      ### Add widgets ###
                      self.add_widget(layout_main)
                      layout_main.add_widget(layout_back_button)
                      layout_main.add_widget(self.scrollview_data)
                  
                      layout_back_button.add_widget(button_back)
                  
                      if self.data_exists:
                          self.layout_data.add_widget(Label(text = 'label 1'))
                          self.layout_data.add_widget(Label(text = 'label 2'))
                          self.layout_data.add_widget(Label(text = 'label 3'))
                          self.display_data(self)
                          self.scrollview_data.add_widget(self.layout_data)
                      else:
                          self.scrollview_data.add_widget(Label(text = 'Records are empty'))
                  
                      ### Create button bindings ###
                      button_back.bind(on_press = switch_screen_to_main)      
                  
                  def display_data(obj, self):
                  
                      data_dictReader = read_csv_to_dictReader()
                  
                      for data_row in data_dictReader:
                          for value in data_row.values():
                              self.layout_data.add_widget( Label( text = value))
                  

                  GridLayout/data 不可滾動.有人可以告訴我如何修復上面的代碼以使其可滾動嗎?謝謝你.

                  The GridLayout/data is not scrollable. Can someone tell me how to fix the code above to make it scrollable? Thank you.

                  推薦答案

                  你不見了 Kivy 文檔中的一些內容 在您的 GridLayout 上.它們是確保 GridLayout 大到可以滾動"的必要條件:

                  You are missing a few things from the Kivy Documentation on your GridLayout. They are necessary to make sure that the GridLayout is "big enough to scroll":

                  1. 您必須確保將 size_hint_y 設置為 None,因為在這種情況下默認的 1 不方便
                  2. GridLayoutminimum_height綁定到layout.setter('height').
                  3. 確保 ScrollView 具有適合滾動的大小
                  1. You got to be sure that you set the size_hint_y to None, because the default 1 is not convenient in this case
                  2. Bind the minimum_height of the GridLayout to layout.setter('height').
                  3. Be sure that the ScrollView has the right size to accommodate the scroll

                  這個例子和你在文檔中找到的差不多:

                  This example is pretty much what you find in the documentation:

                  from kivy.app import App
                  from kivy.uix.scrollview import ScrollView
                  from kivy.uix.gridlayout import GridLayout
                  from kivy.uix.button import Button
                  
                  class Example(App):
                  
                      def build(self):
                          layout = GridLayout(cols=1, spacing=10, size_hint_y=None)
                          # Make sure the height is such that there is something to scroll.
                          layout.bind(minimum_height=layout.setter('height'))
                          for i in range(30):
                              btn = Button(text=str(i), size_hint_y=None, height=40)
                              layout.add_widget(btn)
                          root = ScrollView()
                          root.add_widget(layout)
                          return root
                  
                  if __name__ == '__main__':
                      Example().run()
                  

                  在本例中,ScrollViewWindow 的大小,但您可以使用 size_hintsize 屬性.

                  In this example, the ScrollView is the size of the Window but you can manipulate it with the size_hint and size properties.

                  這篇關于ScrollView 小部件在 kivy 中不滾動的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  How to make a discord bot that gives roles in Python?(如何制作一個在 Python 中提供角色的不和諧機器人?)
                  Discord bot isn#39;t responding to commands(Discord 機器人沒有響應命令)
                  Can you Get the quot;About mequot; feature on Discord bot#39;s? (Discord.py)(你能得到“關于我嗎?Discord 機器人的功能?(不和諧.py))
                  message.channel.id Discord PY(message.channel.id Discord PY)
                  How do I host my discord.py bot on heroku?(如何在 heroku 上托管我的 discord.py 機器人?)
                  discord.py - Automaticaly Change an Role Color(discord.py - 自動更改角色顏色)
                  • <legend id='CxuQF'><style id='CxuQF'><dir id='CxuQF'><q id='CxuQF'></q></dir></style></legend>
                        <tbody id='CxuQF'></tbody>

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

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

                            主站蜘蛛池模板: 灰板纸、灰底白、硬纸板等纸品生产商-金泊纸业 | 喷砂机厂家_自动除锈抛丸机价格-成都泰盛吉自动化喷砂设备 | 数控走心机-走心机价格-双主轴走心机-宝宇百科 | 乳化沥青设备_改性沥青设备_沥青加温罐_德州市昊通路桥工程有限公司 | 多功能三相相位伏安表-变压器短路阻抗测试仪-上海妙定电气 | 北京公积金代办/租房发票/租房备案-北京金鼎源公积金提取服务中心 | 立式矫直机_卧式矫直机-无锡金矫机械制造有限公司 | SRRC认证|CCC认证|CTA申请_IMEI|MAC地址注册-英利检测 | 水平垂直燃烧试验仪-灼热丝试验仪-漏电起痕试验仪-针焰试验仪-塑料材料燃烧检测设备-IP防水试验机 | 舞台木地板厂家_体育运动木地板_室内篮球馆木地板_实木运动地板厂家_欧氏篮球地板推荐 | 亮化工程,亮化设计,城市亮化工程,亮化资质合作,长沙亮化照明,杰奥思【官网】 | 石家庄救护车出租_重症转院_跨省跨境医疗转送_活动赛事医疗保障_康复出院_放弃治疗_腾康26年医疗护送转诊团队 | 电动卫生级调节阀,电动防爆球阀,电动软密封蝶阀,气动高压球阀,气动对夹蝶阀,气动V型调节球阀-上海川沪阀门有限公司 | 宁夏活性炭_防护活性炭_催化剂载体炭-宁夏恒辉活性炭有限公司 | 视觉检测设备_自动化检测设备_CCD视觉检测机_外观缺陷检测-瑞智光电 | 气力输送_输送机械_自动化配料系统_负压吸送_制造主力军江苏高达智能装备有限公司! | 高低温试验箱-模拟高低温试验箱订制-北京普桑达仪器科技有限公司【官网】 | POS机办理_个人pos机免费领取-银联pos机申请首页 | 成都治疗尖锐湿疣比较好的医院-成都治疗尖锐湿疣那家医院好-成都西南皮肤病医院 | 气体热式流量计-定量控制流量计(空气流量计厂家)-湖北南控仪表科技有限公司 | 卫浴散热器,卫浴暖气片,卫生间背篓暖气片,华圣格浴室暖气片 | 液压扳手-高品质液压扳手供应商 - 液压扳手, 液压扳手供应商, 德国进口液压拉马 | 采暖炉_取暖炉_生物质颗粒锅炉_颗粒壁炉_厂家加盟批发_烟台蓝澳采暖设备有限公司 | 自进式锚杆-自钻式中空注浆锚杆-洛阳恒诺锚固锚杆生产厂家 | 高压无油空压机_无油水润滑空压机_水润滑无油螺杆空压机_无油空压机厂家-科普柯超滤(广东)节能科技有限公司 | 东莞精密模具加工,精密连接器模具零件,自動機零件,冶工具加工-益久精密 | Trimos测长机_测高仪_TESA_mahr,WYLER水平仪,PWB对刀仪-德瑞华测量技术(苏州)有限公司 | 水厂污泥地磅|污泥处理地磅厂家|地磅无人值守称重系统升级改造|地磅自动称重系统维修-河南成辉电子科技有限公司 | 今日娱乐圈——影视剧集_八卦娱乐_明星八卦_最新娱乐八卦新闻 | 螺杆泵_中成泵业 | Akribis直线电机_直线模组_力矩电机_直线电机平台|雅科贝思Akribis-杭州摩森机电科技有限公司 | 网站优化公司_北京网站优化_抖音短视频代运营_抖音关键词seo优化排名-通则达网络 | 光谱仪_积分球_分布光度计_灯具检测生产厂家_杭州松朗光电【官网】 | 钢板仓,大型钢板仓,钢板库,大型钢板库,粉煤灰钢板仓,螺旋钢板仓,螺旋卷板仓,骨料钢板仓 | 沈飞防静电地板__机房地板-深圳市沈飞防静电设备有限公司 | 商用绞肉机-熟肉切片机-冻肉切丁机-猪肉开条机 - 广州市正盈机械设备有限公司 | 机器视觉检测系统-视觉检测系统-机器视觉系统-ccd检测系统-视觉控制器-视控一体机 -海克易邦 | 大倾角皮带机-皮带输送机-螺旋输送机-矿用皮带输送机价格厂家-河南坤威机械 | 济南菜鸟驿站广告|青岛快递车车体|社区媒体-抖音|墙体广告-山东揽胜广告传媒有限公司 | 干粉砂浆设备_干混砂浆生产线_腻子粉加工设备_石膏抹灰砂浆生产成套设备厂家_干粉混合设备_砂子烘干机--郑州铭将机械设备有限公司 | 环压强度试验机-拉链拉力试验机-上海倾技仪器仪表科技有限公司 |