2017-06-01 9 views
0

私はkivyでデザインするのが初めてで、タブパネルの中にリストビュー、入力ボックス、ラベルを表示しようとしていますが、空のパネルを表示しています。私は間違いがどこにあるのか分かりません。 入力ボックスにユーザー名を入力するだけで簡単にユーザーの検索を行いたい場合、listviewは自動的にlistview内のレコードを更新します。Kivyのタブ付きパネル内のウィジェット

私はここで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です。だから、余分なレイアウトとあなたがその1つのレイアウト内のタブにしたいすべてのものを置く:

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を作成したので、技術的に私のミスは、ウィジェットの階層でありますタブ付きパネル内のボックスレイアウト –

関連する問題