2017-11-23 1 views
1

나는 약간의 코드를 파이썬 (test.py)과 kivy (test.kv)로 작성했다.

아무도 말해 줄 수있는 내 상자에 세로 스크롤 막대를 추가하는 방법 레이아웃?
    do_scroll_y : 진정한
    do_scroll_x : 거짓
    BoxLayout가 : 내가

Kivy : boxlayout에 세로 스크롤 막대를 추가하는 방법

있는 ScrollView를 사용하고


        동향 : "수직"

하지만 나는 아마도 어딘가에서 실수를 저 지르고 있을지도 모릅니다.

는 내가있는 ScrollView 다음 디자인

test.py를 버릇됩니다 사용하고 때

from kivy.uix.screenmanager import Screen 
from kivy.app import App 
from kivy.lang import Builder 
from kivy.core.window import Window 


Window.clearcolor = (0.5, 0.5, 0.5, 1) 
Window.size = (600, 700) 

class ACgroup(Screen): 
    pass 


class TestACgroup(App): 

    def build(self): 
     self.root = Builder.load_file('test.kv') 
     return self.root 


if __name__ == '__main__': 
    TestACgroup().run() 

test.kv

<[email protected]>: 
    text_size: self.size 
    #padding_x: 5 

<[email protected]>: 
    multiline: False 


<[email protected]>: 
    background_color: 1, 1, 1, 1 
    size_hint_y: None 
    height: self.parent.height * 0.100 

ACgroup: 

    BoxLayout: 
     orientation: "vertical" 

     GridLayout: 
      cols: 2 
      padding : 15, 15 
      spacing: 20, 5 
      row_default_height: '20dp' 
      size_hint: 1, .01 
      pos_hint: {'x': 0, 'y':.95} 

      CustomLabel: 
       text: 'Fname' 
       text_size: self.size 
       halign: 'left' 
       valign: 'middle' 
       size_hint_x: 2 


      SingleLineTextInput: 
       id: acGroup 
       size_hint_x: 7 


      Label: 
       text: 'Name' 
       text_size: self.size 
       halign: 'left' 
       valign: 'middle' 
       size_hint_x: 2 

      SingleLineTextInput: 
       id: stateName 

     GridLayout: 
      cols: 4 
      padding : 15, 10 
      spacing: 20, 5 
      row_default_height: '20dp' 
      size_hint: 1, .01 
      pos_hint: {'x': 0, 'y':.7} 

      CustomLabel: 
       text: 'ADDRESS :-' 

      CustomLabel: 

      CustomLabel: 

      CustomLabel: 

      CustomLabel: 
       text: 'City' 
       text_size: self.size 
       halign: 'left' 
       valign: 'middle' 
       size_hint_x: 2 

      SingleLineTextInput: 
       id: acGroup 
       size_hint_x: 4.5 

      Label: 
       text: 'Pin' 
       text_size: self.size 
       valign: 'middle' 
       halign: 'right' 


      SingleLineTextInput: 
       id: stateCode 

      CustomLabel: 
       text: 'Area' 
       text_size: self.size 
       halign: 'left' 
       valign: 'middle' 
       size_hint_x: 2 

      SingleLineTextInput: 
       id: acGroup 
       size_hint_x: 4.5 

     GridLayout: 

      cols: 6 
      padding: 15, 15 
      spacing: 5, 5 
      row_default_height: '20dp' 
      size_hint: 1, .005 
      pos_hint: {'x': 0, 'y':.5} 

      CustomLabel: 
       text: 'Address' 
       text_size: self.size 
       halign: 'left' 
       valign: 'middle' 
       size_hint_x: 2 
       #size_hint_y: 2 

      SingleLineTextInput: 
       id: acGroup 
       size_hint_x: 3 
       #size_hint_y: 2 

      SingleLineTextInput: 
       id: acGroup 
       size_hint_x: 3 
       #size_hint_y: 0 

     GridLayout: 
      cols: 2 
      padding : 15, 5 
      spacing: 10, 10 
      row_default_height: '20dp' 
      size_hint: 1, .02 
      pos_hint: {'x': 0, 'y':.4} 


      CustomLabel: 
       text: 'CONTACT DETAIL:-' 

      CustomLabel: 

      Label: 
       text: 'Phone' 
       text_size: self.size 
       halign: 'left' 
       valign: 'middle' 
       size_hint_x: 2 

      SingleLineTextInput: 
       id: acGroup 
       size_hint_x: 6.5 
       #size_hint_y: 2 

      Label: 
       text: 'Mobile' 
       text_size: self.size 
       halign: 'left' 
       valign: 'middle' 
       size_hint_x: 2 

      SingleLineTextInput: 
       id: acGroup 
       size_hint_x: 6.5 
       #size_hint_y: 2 

      Label: 
       text: 'E-Mail' 
       text_size: self.size 
       halign: 'left' 
       valign: 'middle' 
       size_hint_x: 2 

      SingleLineTextInput: 
       id: acGroup 
       size_hint_x: 6.5 
       #size_hint_y: 2 


      GreenButton: 
       text: 'Ok' 


      GreenButton: 
       text: 'Cancel' 
       on_press: app.stop() 

누군가가 나를 도울 수 있습니까?

답변

1

당신이 수직있는 ScrollView를 사용하는 경우이 같은 유일한 아이의 높이를 설정해야합니다

ScrollView: 
    BoxLayout: 
     size_hint_y: None 
     height: #the height that you want 
관련 문제