wxPanel and Refesh()

I tried that and it didn't work. What I ended up doing was following Refresh() with wxPostEvent(self, wxPyEvent()), and that seems to produce the desired behaviour (haven't tried it on MSWin yet). Seems like a bit of a hack though... I'd appreciate some more input if anyone has any ideas... thanks :slight_smile:

    Jeff

路路路

jahurt644@netscape.net wrote:

I'm having a heck of a time trying to Refesh a panel. Here's the scenario...

I have a server application running on an embedded system and a client module in pure Python. I want to create a GUI application that shows the state of the connection on program startup. I have code in a wxFrame that looks something like this...

...

def PollForConnection(self):
    while self.eth.Connected() is False:
        time.sleep(5)
    self.panel.Result.SetLabel('Connection Established')
    self.panel.Refresh(True)
    print 'Updating GUI'
    sys.stdout.flush()

('Result' is a wxStaticText object)

The problem is that it can take anywhere between 0 and 20 seconds after the call to 'Refresh()' for the panel to redraw itself. Curiously, if there is a pending Refresh, the panel will redraw itself immediately when I drag the mouse pointer over it. I'm a wxWidgets newbie, so I'm at a bit of a loss here...
I'm using python 2.3 and wxWidgets 2.4.2 on Debian Linux... ideally, I would like a solution that works on both linux and MSWin. Anyone have any ideas? Thanks...

This came up a while back, and from what I remember Refresh() pretty
much just marks the window as "dirty" but calling Update() causes the
dirty window to be immediately repainted. So you call Refresh() then
Update(). I think ...

Paul Probert

__________________________________________________________________
Switch to Netscape Internet Service.
As low as $9.95 a month -- Sign up today at AOList Teil der Yahoo Markenfamilie

Netscape. Just the Net You Need.

New! Netscape Toolbar for Internet Explorer
Search from anywhere on the Web and block those annoying pop-ups.
Download now at AOList Teil der Yahoo Markenfamilie

jahurt644@netscape.net wrote:

This came up a while back, and from what I remember Refresh() pretty much just marks the window as "dirty" but calling Update() causes the dirty window to be immediately repainted. So you call Refresh() then Update(). I think ...
   
Paul Probert
   
I tried that and it didn't work. What I ended up doing was following Refresh() with wxPostEvent(self, wxPyEvent()), and that seems to produce the desired behaviour (haven't tried it on MSWin yet). Seems like a bit of a hack though... I'd appreciate some more input if anyone has any ideas... thanks :slight_smile:

I haven't been following this conversation particularly, but from what I see here, it seems that calling wxWakeUpIdle() may help. You may be stacking up various tasks to be done the next time that the event queue becomes empty... but if that queue is *already* empty, then an event needs to happen before it can *become* empty again. That's what sending that dummy event does, but wxWakeUpIdle() should do the same thing a bit more cleanly.

Jeff Shannon
Technician/Programmer
Credit International