2017-05-30 3 views
0

私は16dpのマージンを使ってウィジェットを下部と右の位置に配置しようとしていますが、いくつかのレイアウトでそれを試してみました。うまくいかない。誰か助けてくれますか?Kivy - 下部と右の位置のウィジェットとマージン

ex35.py

from kivy.app import App 
from kivy.core.window import Window 
Window.clearcolor = (1, 1, 1, 1) 

class Ex35(App): 
    pass 

Ex35().run() 

ex35.kv

FloatLayout: 
    BoxLayout: 
     orientation:'vertical' 
     Button: 
      text:'Hello' 
     Button: 
      text:'Hello' 
     Button: 
      text:'Hello' 
     Button: 
      text:'Hello' 
     Button: 
      text:'Hello' 
     Button: 
      text:'Hello' 
     Button: 
      text:'Hello' 
     Button: 
      text:'Hello' 

    Widget: 
     id: ellipse 
     size_hint: (None, None) 
     size: (dp(56), dp(56)) 
     canvas: 
      Color: 
       rgba: 0, 1, 0, 1 
      Ellipse: 
       size: self.size 

enter image description here

+0

あなたは 'pos_hint'を試しましたか?正確に16dpのマージンを意味しますか?右と下から16dpのスペースのように? –

+0

Margim 16dp Ellipseに 'pos:(dp(16)、dp(16))'を追加しました。私が得意ではないのは、楕円を一番下に置くことです – rafaelcb21

答えて

0

私は以下のコードでそれを得た:

FloatLayout: 
    BoxLayout: 
     orientation:'vertical' 
     Button: 
      text:'Hello' 
     Button: 
      text:'Hello' 
     Button: 
      text:'Hello' 
     Button: 
      text:'Hello' 
     Button: 
      text:'Hello' 
     Button: 
      text:'Hello' 
     Button: 
      text:'Hello' 
     Button: 
      text:'Hello' 

    Widget: 
     id: ellipse 
     size_hint: (None, None) 
     size: (dp(56), dp(56)) 
     pos_hint:{'right': 1} 
     canvas.before: 
      Color: 
       rgba: 0, 1, 0, 1 
      Ellipse: 
       size: self.size 
       pos: [dp(self.pos[0]) - dp(16), dp(self.pos[1]) + dp(16)] 

enter image description here

関連する問題