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
评论列表
文章目录