문제

패널의 컨트롤을 수정하고 업데이트 한 다음 코드 실행을 계속하려고합니다. 문제는 패널이 새로 고침되기 전에 유휴를 기다리고있는 것 같습니다. 물론 getsizer (). layout ()뿐만 아니라 새로 고침을 시도했으며 sendsizeevent () 메소드를 사용하여 크기 조정 이벤트를 프레임에 보냈지 만 소용이 없습니다. 나는 여기서 상실하고 있습니다. 나는이 패널을 다시 그리기를 강요 할 방법이 없다고 믿기가 어렵다는 것을 알게되었습니다. 다음은 컨트롤을 변경하는 코드입니다.

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()

다른 사람이 이와 같은 사람이 있습니까? 그렇다면 어떻게 해결 했습니까?

도움이 되었습니까?

해결책

당신은 전화해야합니다 Update 방법.

다른 팁

나는 가졌다 StaticBitmap 마찬가지로, 이러한 기술 중 어느 것도 업데이트되지 않을 것입니다 ( Update 받아 들여진 답변에서 제안).

나는 그 부름을 발견했다 .Hide() 그리고 .Show()Panel 이미지를 새로 고치기에 충분했습니다. 내가 같은 하위 수준의 객체에 대해 함수를 실행하면 동일 할 것이라고 생각합니다. StaticBitmap.

패널의 변이 가능한 부분을 서브 패널에 넣을 수 있습니다.

def MakeButtonPanels(self):
    self.buttonPanel1 = wx.Panel(self)
    self.Add(self.buttonPanel1, 0, wxALL|wxALIGN_LEFT, 5)
    # ... make the three buttons and the button sizer on buttonPanel1

    self.buttonPanel2 = wx.Panel(self)
    self.Add(self.buttonPanel2, 0, wxALL|wxALIGN_LEFT, 5)
    # ... make the loading label and its sizer on buttonPanel2

    self.buttonPanel2.Show(False) # hide it by default

def HideButtons(self):
    self.buttonPanel1.Show(False)
    self.buttonPanel2.Show(True)
    self.Layout()
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top