如何强制刷新wx.Panel? [英] How do you force refresh of a wx.Panel?
问题描述
我试图修改面板的控件,进行更新,然后继续执行代码.问题似乎在于面板在刷新之前正在等待空闲.我当然尝试过刷新以及GetSizer().Layout(),甚至使用SendSizeEvent()方法将调整大小事件发送到框架,但无济于事.我在这里不知所措,我很难相信没有办法强制重新绘制此面板.这是更改控件的代码:
I am trying to modify the controls of a Panel, have it update, then continue on with code execution. The problem seems to be that the Panel is waiting for Idle before it will refresh itself. I've tried refresh of course as well as GetSizer().Layout() and even sent a resize event to the frame using the SendSizeEvent() method, but to no avail. I'm at a loss here, I find it difficult to believe there is no way to force a redrawing of this panel. Here is the code that changes the controls:
def HideButtons(self):
self.newButton.Show(False)
self.openButton.Show(False)
self.exitButton.Show(False)
self.buttonSizer.Detach(self.newButton)
self.buttonSizer.Detach(self.openButton)
self.buttonSizer.Detach(self.exitButton)
loadingLabel = wx.StaticText(self.splashImage, wx.ID_ANY, "Loading...", style=wx.ALIGN_LEFT)
loadingLabel.SetBackgroundColour(wx.WHITE)
self.buttonSizer.Add(loadingLabel)
self.GetSizer().Layout()
self.splashImage.Refresh()
还有其他人遇到过这样的事情吗?如果是这样,您是如何解决的?
Has anybody else encountered anything like this? And how did you resolve it if so?
推荐答案
You need to call the Update
method.
这篇关于如何强制刷新wx.Panel?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!