2017-06-01 22 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 –

相關問題