久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

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

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

  1. <tfoot id='iiawI'></tfoot>

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

    1. Python Kivy ListView:如何刪除選定的 ListItemButton?

      Python Kivy ListView: How to delete selected ListItemButton?(Python Kivy ListView:如何刪除選定的 ListItemButton?)
        <bdo id='UjUbY'></bdo><ul id='UjUbY'></ul>
          <tbody id='UjUbY'></tbody>
      • <legend id='UjUbY'><style id='UjUbY'><dir id='UjUbY'><q id='UjUbY'></q></dir></style></legend>
        <tfoot id='UjUbY'></tfoot>

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

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

              • 本文介紹了Python Kivy ListView:如何刪除選定的 ListItemButton?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                我正在嘗試通過構建一個簡單的待辦事項列表應用程序來學習 kivy,就像在 Kivy 中創建應用程序"一書的作者 Dusty Phillips 所建議的那樣.

                I'm trying to learn kivy by building a simple todo-list app like suggested by Dusty Phillips, author of the book "Creating apps in Kivy".

                這是目前為止的代碼:

                from kivy.app import App
                from kivy.uix.boxlayout import BoxLayout
                from kivy.properties import ObjectProperty
                from kivy.uix.listview import ListItemButton
                
                
                class TaskButton(ListItemButton):
                    pass
                
                
                class TodoRoot(BoxLayout):
                    task_input = ObjectProperty()
                    task_list = ObjectProperty()
                
                    def add_task(self):
                        self.task_list.adapter.data.extend([self.task_input.text])
                        self.task_list._trigger_reset_populate()
                
                    def del_task(self):
                        pass
                
                
                class TodoApp(App):
                    def build(self):
                        return TodoRoot()
                
                
                if __name__ == '__main__':
                    TodoApp().run()
                

                這是kv文件:

                #: import main todo
                #: import ListAdapter kivy.adapters.listadapter.ListAdapter
                #: import ListItemButton kivy.uix.listview.ListItemButton
                
                TodoRoot:
                
                <TodoRoot>:
                    orientation: "vertical"
                    task_input: task_input_view
                    task_list: tasks_list_view
                
                    BoxLayout:
                        size_hint_y: None
                        height: "40dp"
                
                        TextInput:
                            id: task_input_view
                            size_hint_x: 70
                        Button:
                            text: "Add"
                            size_hint_x: 15
                            on_press: root.add_task()
                        Button:
                            text: "Del"
                            size_hint_x: 15
                            on_press: root.del_task()
                    ListView:
                        id: tasks_list_view
                        adapter:
                            ListAdapter(data=[], cls=main.TaskButton)
                

                這是它的樣子:

                我知道 ListView API 仍處于試驗階段,我抱怨有關使用適配器/轉換器、google &所以搜索也沒有幫助.那么需要什么代碼才能使 Del-Button 工作并刪除選定的 ListItemButton?

                I know the ListView API is still somewhat experimental and I'm complaining about the examples on using adapters / converters, google & SO search didn't help either. So what code is needed to make the Del-Button work and remove a selected ListItemButton?

                推薦答案

                大量閱讀 ListView API docs &例子,我終于找到了自己.我們需要的是listadapter-Class的selection-Property,那么我們可以簡單的調用adapter.data-ListProperty繼承的remove方法.

                After a lot of reading ListView API docs & examples, I finally found out myself. What we need is the selection-Property of the listadapter-Class, then we can simply call the inherited remove method of the adapter.data-ListProperty.

                所以對于任何有興趣的人來說,這是代碼:

                So for anyone interesested this is the code:

                def del_task(self, *args):
                    if self.task_list.adapter.selection:
                        selection = self.task_list.adapter.selection[0].text
                        self.task_list.adapter.data.remove(selection)
                        self.task_list._trigger_reset_populate()
                

                這篇關于Python Kivy ListView:如何刪除選定的 ListItemButton?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 - 自動更改角色顏色)
                • <bdo id='JLRkl'></bdo><ul id='JLRkl'></ul>

                        <tbody id='JLRkl'></tbody>

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

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

                          主站蜘蛛池模板: 国产玖玖 | 亚洲一区中文字幕 | 国产精品mv在线观看 | 男人天堂网av | 最新伦理片 | 久久久久久电影 | 久久久av | a级免费观看视频 | 日韩一级欧美一级 | www.日韩av.com | 久久精品国产一区二区电影 | 91福利网| 红桃成人在线 | 国产精品日韩欧美一区二区三区 | www国产精品 | 亚洲视频中文字幕 | 欧美午夜激情在线 | av中文字幕在线 | av中文字幕在线 | 一区二区亚洲 | 91精品国产91综合久久蜜臀 | 波多野结衣中文字幕一区二区三区 | 亚洲三区在线观看 | 国产一区二区三区久久久久久久久 | 亚洲精品久久久一区二区三区 | 日韩中文字幕视频在线观看 | 国产精品日韩一区 | 在线成人一区 | 亚洲视频手机在线 | 中国大陆高清aⅴ毛片 | 一级做受毛片免费大片 | 久久69精品久久久久久国产越南 | 色呦呦在线 | 亚洲成人一区二区 | 欧美激情在线精品一区二区三区 | 一区二区三区视频在线 | 亚洲国产精品福利 | 男女羞羞视频在线 | 91影院在线观看 | 日韩欧美国产精品一区二区三区 | av一级在线观看 |