当前位置: 首页>>代码示例>>Python>>正文


Python treeview.TreeView类代码示例

本文整理汇总了Python中kivy.uix.treeview.TreeView的典型用法代码示例。如果您正苦于以下问题:Python TreeView类的具体用法?Python TreeView怎么用?Python TreeView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了TreeView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: build

    def build(self):
        root = BoxLayout(orientation='horizontal', padding=20, spacing=20)
        tree = TreeView(
            size_hint=(None, 1), width=200, hide_root=True, indent_level=0)

        def create_tree(text):
            return tree.add_node(TreeViewLabel(
                text=text, is_open=True, no_selection=True))

        def attach_node(text, n):
            tree.add_node(TreeViewLabel(text=text), n)

        tree.bind(selected_node=self.on_select_node)
        n = create_tree('Widgets')
        attach_node('Standard widgets', n)
        attach_node('Complex widgets', n)
        attach_node('Scatters', n)
        attach_node('Treeviews', n)
        attach_node('Popup', n)
        n = create_tree('Layouts')
        attach_node('Anchor Layout', n)
        attach_node('Box Layout', n)
        attach_node('Float Layout', n)
        attach_node('Grid Layout', n)
        attach_node('Stack Layout', n)
        root.add_widget(tree)
        self.content = content = BoxLayout()
        root.add_widget(content)
        sc = Showcase()
        sc.content.add_widget(root)
        self.content.add_widget(StandardWidgets())
        return sc
开发者ID:dekoza,项目名称:kivy,代码行数:32,代码来源:main.py

示例2: build

    def build(self):
        root = BoxLayout(orientation='horizontal', padding=20, spacing=20)
        tree = TreeView(size_hint=(None, 1), width=200, hide_root=True,
                        indent_level=0)

        def create_tree(text):
            return tree.add_node(TreeViewLabel(
                text=text, is_open=True, no_selection=True))

        def attach_node(text, n):
            tree.add_node(TreeViewLabel(text=text), n)

        tree.bind(selected_node=self.on_select_node)
        n = create_tree('Buttons')
        attach_node('Standard buttons', n)
        attach_node('Options buttons', n)
        n = create_tree('Sliders')
        attach_node('Horizontal sliders', n)
        attach_node('Vertical sliders', n)
        n = create_tree('Scatter')
        attach_node('Scatter with image', n)
        attach_node('Scatter with buttons', n)
        n = create_tree('Textinput')
        attach_node('Monoline textinput', n)
        attach_node('Multiline textinput', n)
        n = create_tree('TreeView')
        attach_node('Standard treeview', n)
        attach_node('Treeview without root', n)
        root.add_widget(tree)
        self.content = content = BoxLayout()
        root.add_widget(content)
        sc = Showcase()
        sc.content.add_widget(root)
        return sc
开发者ID:SparrowG,项目名称:kivy,代码行数:34,代码来源:main.py

示例3: create_scrollable_treeview

def create_scrollable_treeview(nested_dicts, onclick, root_label):
    tv = TreeView(root_options={'text': root_label})

    def populate_tree(parent, level, index, path):
        obj = level if index is None else level[index]
        if hasattr(obj, 'name'):
            label = TreeViewLabel(text=obj.name,
                                  onclick=onclick)
            label.path = copy(path)
            tv.add_node(label, parent)
        else:
            try:
                indices = obj.iterkeys()
            except AttributeError:
                indices = xrange(len(obj))
            # This `if` is a hack to deal with the root of the given tree
            if index is None:
                group_node = None
            else:
                group_node = TreeViewLabel(text=index)
                tv.add_node(group_node, parent)
            for index in indices:
                populate_tree(group_node, obj, index, path + [index])

    populate_tree(None, nested_dicts, None, [])

    # Make the tree scrollable inside the ScrollView
    tv.size_hint_y = None
    tv.bind(minimum_height=tv.setter('height'))
    scrollable = ScrollView()
    scrollable.add_widget(tv)
    return scrollable
开发者ID:ihaque,项目名称:grizzly,代码行数:32,代码来源:kivy_view.py

示例4: build

    def build(self):
        root = BoxLayout(orientation="horizontal", padding=20, spacing=20)
        tree = TreeView(size_hint=(None, 1), width=200, hide_root=True, indent_level=0)

        def create_tree(text):
            return tree.add_node(TreeViewLabel(text=text, is_open=True, no_selection=True))

        def attach_node(text, n):
            tree.add_node(TreeViewLabel(text=text), n)

        tree.bind(selected_node=self.on_select_node)
        n = create_tree("Buttons")
        attach_node("Standard buttons", n)
        attach_node("Options buttons", n)
        attach_node("Horizontal sliders", n)
        attach_node("Vertical sliders", n)
        attach_node("Scatter with image", n)
        attach_node("Scatter with buttons", n)
        attach_node("Monoline textinput", n)
        attach_node("Multiline textinput", n)
        attach_node("Standard treeview", n)
        attach_node("Treeview without root", n)
        attach_node("Accordion", n)
        attach_node("Popup", n)
        attach_node("Switch", n)
        n = create_tree("Experimentals")
        attach_node("Filechooser icon", n)
        attach_node("Filechooser list", n)
        root.add_widget(tree)
        self.content = content = BoxLayout()
        root.add_widget(content)
        sc = Showcase()
        sc.content.add_widget(root)
        return sc
开发者ID:tanayz,项目名称:kivyapp,代码行数:34,代码来源:main1.py

示例5: __init__

 def __init__(self, *args, **kwargs):
     TreeView.__init__(self, *args, **kwargs)
     #Now, bind yourseilf on list of templates
     from scripts import scriptList
     scriptList.bind(scripts=self.Rebuild)
     self.Rebuild()
     #Now add on load
     self.load_func = self.node_loader
开发者ID:opqopq,项目名称:BoardGameMaker,代码行数:8,代码来源:deck.py

示例6: build

 def build(self):
     #for i in range(30):
     #    btn = Button(text=str(i), size=(480, 40),
     #                 size_hint=(None, None))
     #    layout.add_widget(btn)
     tv = TreeView(root_options=dict(text='Tree One'), hide_root=True, indent_level=4)
     tv.size_hint = 1, None
     tv.bind(minimum_height = tv.setter('height'))
     populate_tree_view(tv)
     root = ScrollView(pos = (0, 0))
     root.add_widget(tv)
     return root
开发者ID:MartenButter,项目名称:Miniproject,代码行数:12,代码来源:TreeView.py

示例7: getTreeViewAsFiles

 def getTreeViewAsFiles(self):
     try:
         tv = TreeView(hide_root=True)
         tv.size_hint = 1, None
         tv.bind(minimum_height = tv.setter('height'))
         
         for key in self.config_files:
             newnode = tv.add_node(TreeViewLabel(text=self.config_files[key].filename, font_size=self.label_font_size, color=self.filename_label_color))
             
             for child_filename in self.config_files[key].child_files:
                 self._addFileNodeToFileTreeView(tv, newnode, self.config_files[key].child_files[child_filename])
                 
             for configkey in self.config_files[key].config:
                 if isinstance(self.config_files[key].config[configkey], dict):
                     self._addDictNodeToFileTreeView(tv, newnode, configkey, self.config_files[key].config[configkey])
                 else:
                     tv.add_node(TreeViewLabel(text=str(configkey) + ':' + str(self.config_files[key].config[configkey]), font_size=self.label_font_size, color=self.key_label_color), newnode)
                             
         scv = ScrollView(pos = (0, 0), bar_width = 10)
         scv.add_widget(tv)
         return scv
     except:
         e = sys.exc_info()[0]
         self.log.exception("Error: %s" % e )
         raise
开发者ID:missionpinball,项目名称:mpf-wizard,代码行数:25,代码来源:mpf_wizard_ui.py

示例8: agacGorunumu

class agacGorunumu(App):

    def build(self):
        duzen=BoxLayout(orientation='vertical')
        
        self.agac_koku = TreeView(hide_root=True)
        
        kuruyemisler=[('Sert Kabuklular',('Ceviz', 'Fındık', 'Badem')), 
                      ('Meyve Kuruları',('Dut', 'Vişne', 'Kayısı', 'İncir'))]
        
        for ky in kuruyemisler:
            eb=self.agac_koku.add_node(TreeViewLabel(text=ky[0]))
            for k in ky[1]:
                self.agac_koku.add_node(TreeViewLabel(text=k),eb)
        
        duzen.add_widget(self.agac_koku)
        
        return duzen
开发者ID:mbaser,项目名称:kivy-tr,代码行数:18,代码来源:main.py

示例9: __init__

    def __init__(self, **kwargs):
        BoxLayout.__init__(self, **kwargs)

        self.nodes = []
        self.tree = TreeView(hide_root=True)

        #   Create UI
        self.add_node()
        self.add_widget(self.tree)
开发者ID:M4A1Predator,项目名称:TreeExample,代码行数:9,代码来源:mytree.py

示例10: build

    def build(self):
        root = BoxLayout(orientation='horizontal', padding=20, spacing=20)
        tree = TreeView(size_hint=(None, 1), width=200, hide_root=True, indent_level=0)
        tree.bind(selected_node=self.on_select_node)
        n = tree.add_node(TreeViewLabel(text=u'Меню', is_open=True, no_selection=True)) 

        n = tree.add_node(TreeViewLabel(text=u'Управление', is_open=True, no_selection=True)) 
        tree.add_node(TreeViewLabel(text=u'Открыть'), n, ) 
        tree.add_node(TreeViewLabel(text=u'Закрыть'), n) 

        n = tree.add_node(TreeViewLabel(text=u'Настройки', is_open=True, no_selection=True)) 
        #tree.add_node(TreeViewLabel(text='Что то еще'), n) 



        root.add_widget(tree)
        self.content = content = BoxLayout()
        root.add_widget(content)
        sc = Showcase()
        sc.content.add_widget(root)
        return sc
开发者ID:jorik041,项目名称:Remote-control,代码行数:21,代码来源:main.py

示例11: update_content

    def update_content(self, *args):
        widget = self.console.widget
        if not widget:
            return

        from kivy.uix.scrollview import ScrollView
        self.root = root = BoxLayout()
        self.sv = sv = ScrollView(scroll_type=["bars", "content"])
        treeview = TreeView(hide_root=True, size_hint_y=None)
        treeview.bind(minimum_height=treeview.setter("height"))
        keys = list(widget.properties().keys())
        keys.sort()
        node = None
        wk_widget = weakref.ref(widget)
        for key in keys:
            text = '%s' % key
            node = TreeViewProperty(text=text, key=key, widget_ref=wk_widget)
            node.bind(is_selected=self.show_property)
            try:
                widget.bind(**{
                    key: partial(self.update_node_content, weakref.ref(node))
                })
            except:
                pass
            treeview.add_node(node)

        root.add_widget(sv)
        sv.add_widget(treeview)
        self.console.set_content(root)
开发者ID:bob-the-hamster,项目名称:kivy,代码行数:29,代码来源:console.py

示例12: agacGorunumu

class agacGorunumu(App):

    def build(self):
        duzen=BoxLayout(orientation='vertical')
        
        self.agac_koku = TreeView(hide_root=True, size_hint_y=0.8)
        
        kuruyemisler=[('Sert Kabuklular',('Ceviz', 'Fındık', 'Badem')), 
                      ('Meyve Kuruları',('Dut', 'Vişne', 'Kayısı', 'İncir'))]
        
        for ky in kuruyemisler:
            eb=self.agac_koku.add_node(TreeViewLabel(text=ky[0]))
            for k in ky[1]:
                self.agac_koku.add_node(TreeViewLabel(text=k),eb)

        duzen.add_widget(self.agac_koku)
        dgm=Button(text='Elemanları Yaz', size_hint_y=0.2)
        dgm.bind(on_press=self.elemanlari_yaz)
        duzen.add_widget(dgm)
        
        return duzen
        
        
    def elemanlari_yaz(self, *args):
        for eb in self.agac_koku.iterate_all_nodes():
            print eb.level, eb.text
            
        if self.agac_koku.selected_node:
            print "Seçili Eleman", self.agac_koku.selected_node.text
            
         
        print self.agac_koku.get_node_at_pos((1,1))
开发者ID:mbaser,项目名称:kivy-tr,代码行数:32,代码来源:main2.py

示例13: AddAsset

 def AddAsset(self):
     """show the add asset dialog"""
     try:
         popup = Popup(title="select asset")
         popup.size_hint = (0.8,0.8)
         tv = TreeView(root_options=dict(text='Tree One'), hide_root=True, indent_level=4)
         tv.size_hint = 1, None
         tv.bind(minimum_height = tv.setter('height'))
         tv.load_func = self.populateTreeNode
         tv.bind(selected_node=self.on_assetSelected)
         root = ScrollView(pos = (0, 0))
         root.add_widget(tv)
         popup.add_widget(root)
         popup.open()
     except Exception as e:
         showError(e)
开发者ID:ATT-JBO,项目名称:ATTBrokerMonitor,代码行数:16,代码来源:main.py

示例14: build

 def build(self):
     l = BoxLayout(orientation='vertical')
     b = Button(text='Run')
     b.bind(on_press=self.btn_run)
     b.size_hint = 1, 1
     sv = ScrollView()
     sv.size_hint = 1, 10
     self.tv = TreeView(root_options=dict(text='Results'))
     self.tv.size_hint = 1, None 
     self.tv.bind(minimum_height = self.tv.setter('height')) 
     sv.add_widget(self.tv)
     l.add_widget(b)
     l.add_widget(sv)
     return l
开发者ID:RedFoxPi,项目名称:Playground,代码行数:14,代码来源:FileCheckUi.py

示例15: on_pre_enter

    def on_pre_enter(self, *args):
        controller.setup_stash()
        # use thread for background task, use clock in a background task to access the ui
        threading.Thread(target=self.setup_cloud_task).start()
        file_names = controller.get_uploaded_file_names()
        self.file_view = TreeView(hide_root=True, indent_level=4)
        self.file_view.size_hint = 1, None
        self.file_view.bind(minimum_height=self.file_view.setter('height'))
        self.scroll_view.add_widget(self.file_view)
        for file_name in file_names:
            self.file_view.add_node(TreeViewLabel(text=file_name))

        self.max_storage_size = controller.get_max_storage_size()
        self.usage_bar.max = self.max_storage_size
        self.update_storage_view()
开发者ID:marcjulian,项目名称:pyoram,代码行数:15,代码来源:ui.py


注:本文中的kivy.uix.treeview.TreeView类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。