piemenu.py 文件源码

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

项目:cebl 作者: idfah 项目源码 文件源码
def growBar(self, choice, amount, refresh=True):
        """Grow a selection bar toward a menu cell.

        Args:
            choice: String name of the menu cell to grow
                    the bar toward.

            amount: Floating point amount to grow the
                    bar.  Must be between 0.0 and 1.0
                    with 1.0 growing the bar all the
                    way to the cell and 0.0 not
                    growing the bar at all.

        Returns:
            True if the bar for choice meets or exceeds
            1.0 and False otherwise.

        Events:
            A PieMenuSelectEvent is posted if the bar
            length for choice meets or exceeds 1.0.
        """
        self.bars[choice] += amount

        if self.bars[choice] < 0.0:
            self.bars[choice] = 0.0

        if refresh:
            self.refresh()

        if np.isclose(self.bars[choice], 1.0) or self.bars[choice] > 1.0:
            self.bars[choice] = 1.0
            wx.PostEvent(self, PieMenuSelectEvent(choice=choice, id=wx.ID_ANY))
            return True
        else:
            return False
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号