piemenu.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:cebl 作者: idfah 项目源码 文件源码
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()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号