for steps in []
IronPython WPF アプリケーション内で Polyline() を使用して、ループの非常に単純な例を作成しようとしています。ループの反復ごとに異なる色を描画する必要がありますが、Brushes は定義済みの System.Windows.Media.SolidColorBrush オブジェクトのセットを実装しています。変数を交換Red
する方法がわかりません。steps
def polylineShape(self):
x = self.myCanvas.Width/2
y = self.myCanvas.Height/2
polyline = Polyline()
polyline.StrokeThickness = 5
for steps in ['Red','Blue','Green','Black']:
x = x
y = x
polyline.Points.Add(Point(x,y))
x = x + 40
polyline.Points.Add(Point(x,y))
polyline.Stroke = Brushes.Red #change colour on iteration
self.myCanvas.Children.Add(polyline)