2017-06-01 75 views
0

我是新来的基维设计,我试图显示一个列表视图,inputbox和标签内的Tab面板,但它显示空的面板。我不确定我的错误在哪里。 我想通过在输入框中输入用户名来简单搜索用户,然后listview会自动更新listview中的记录。基维中的选项卡式面板内的小部件

我使用kivy 1.10.0和Python 3.6

这是我在kivy文件代码:

<[email protected]>:#===================MAIN SCREEN========================= 
txt_search: txt_search 
view_user_list: view_user_list 

BoxLayout: 
    size_hint_y: 1 
    size_hint_x: 1 

    canvas: 
     Color: 
      rgb: .132, .232, .249 
     Rectangle: 
      size: self.size 

    TabbedPanel: 
     do_default_tab: False 

     TabbedPanelItem: 
      text:"1st Tab" 
      Label: 
       text: "Content of Admin Panel" 

     TabbedPanelItem: 
      text:"2nd Tab" 
      Label: 
       text: "Content of Second Panel" 

     TabbedPanelItem: 
      text:"Manage Users" 
      BoxLayout: 
       size_hint_y: .2 
       size_hint_x: 1 
       orientation: 'horizontal' 

       Label: 
        text: "Search User" 
        size_hint_x: .25 
        spacing: .2, .2 

       TextInput: 
        id: txt_search 
        text: "" 
        size_hint_x: .3 
        spacing: .2, .2 
      Label: 
       id: lbl_search 
       size_hint_y:None 
       height: 10 
       text: "" 

      ListView: 
       color: [0,0,0] 
       id: view_user_list 
       size_hint_x: 1 
       size_hint_y: .8 
       item_strings: [] 
       adapters: 
        ListAdapter(data=[], cls = ListItemButton) 

回答

0

我不认为有一个TabbedPanelItem多个小部件是允许的,有只有一个孩子 - content。所以,只要把你想要一个额外的布局,一切都在标签是一个布局内:

BoxLayout: # The only child of panel item 
    size_hint_y: 1 
    size_hint_x: 1 
    orientation: 'horizontal' 

    BoxLayout: 
     size_hint_y: 0.2 
     size_hint_x: 1 
     orientation: 'horizontal' 

     Label: 
      text: "Search User" 
      size_hint_x: .25 
      spacing: .2, .2 

     TextInput: 
      id: txt_searh 
      text: "" 
      size_hint_x: .3 
      spacing: .2, .2 
    Label: 
     id: lbl_search 
     size_hint_y:None 
       ... 
+0

谢谢,我跟你说的话,所以在技术上我的错误是小部件的层次,所以我创建了主内几个boxlayouts在标签面板内boxlayout –

相关问题