我有一个wxpython网格,我正在改变一个单元格的背景颜色,以显示它发生了什么。在
我想淡入淡出颜色变化(比如浏览器中的JavaScript),以获得更流畅的外观。这有可能吗?在
现在,我只是改变背景色,然后在1.5秒的间隔后再改回来。在
def do_stuf(self):
# ... stuff ...
wx.CallAfter(self.HighlightCell, row, col)
def HighlightCell(self, row, col):
self.grid.Table.highlight = (row, col)
self.grid.ForceRefresh()
wx.CallLater(1500, self.ClearCellHighlight)
def ClearCellHighlight(self):
self.grid.Table.highlight = None
self.grid.ForceRefresh()
然后在虚拟表中,检查单元格是否需要高亮显示:
^{pr2}$或者,有没有另一种很好的方式来表示一个单元格的内容发生了变化?在
据我所知,您只能在框架小部件上设置透明度,并查看其对所有子控件的影响。我不记得为什么在单独的小部件上设置透明度不起作用。无论如何,模拟这种情况的一个不错的方法是使用wx定时器它循环使用一种颜色的不同色调的列表,然后当迭代完成时,将其重置为正常颜色。这应该能很好地模拟这个样子。在
这是我前一段时间做的一件事,得到一个listcrl,其中的项在删除时会淡出。将代码保存到淡出.py然后运行它来看看演示。适应网格应该不难。在
相关问题 更多 >
编程相关推荐