Kivy

2017-01-18 5 views
0

円のフラグメントの形状を変更するにはどうすれば円このcircleKivy

のように、私のKVファイルで探している:

<FragmentOfCircle>: 
    size: self.size 
    canvas: 
     Color: 
      rgb: (0.7, 0, 1) 
     Line: 
      width: self.circlewidth 
      circle: 
       (self.center_x, self.center_y, min(self.width, self.height), 
       0,60) 

と私は6つのフラグメントを持っていると私はの形状を変更したいですそれらの断片が互いに接続されている場所に置く。例STH like this

しかし、どのようにcap属性を使用して、この形状

答えて

1

を変更するための 。 'none'
に設定してください。

from kivy.uix.widget import Widget 
from kivy.app import App 
from kivy.graphics import Line, Color 


class Circle(Widget): 

    def __init__(self,**kwargs): 
     super(Circle,self).__init__(**kwargs) 
     segments = 12 
     seg = 360/segments 
     with self.canvas: 
      for i in range(1,segments+1): 
       Color(1.0/segments*i,1,1,mode="hsv") 
       Line(circle=[200,200,100, 
          seg*i-1, 
          seg*i+seg], 
          width=15, cap="none") 

class MyApp(App): 

    def build(self): 
     return Circle() 


MyApp().run()