def drawBars(self, gc):
"""Draw the bars reaching to the menu cells.
"""
gc.SetPen(wx.Pen((80,80,80), 2))
# figure bar width using number of bars and apothem of polygon
r = 0.1 * self.winRadius
barWidth = np.sqrt((r*(np.cos(self.angle)-1.0))**2+(r*np.sin(self.angle))**2)
apothem = r * np.cos(self.angle/2.0)
# for each angle, color, choice triple
for angle, color, choice in zip(self.midAngles, self.curColors, self.choices):
# set fill color
gc.SetBrush(wx.Brush(color))
# figure bar length
barLength = self.bars[choice] * (0.70*self.winRadius - apothem)
# smallRadius
# rotate and draw bar
gc.PushState()
gc.Rotate(angle)
gc.DrawRectangle(apothem, -barWidth/2.0, barLength, barWidth)
gc.PopState()
评论列表
文章目录