Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
926 views
in Technique[技术] by (71.8m points)

python - How do you force refresh of a wx.Panel?

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You need to call the Update method.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...