Newbie Question

Hello... I'm still a bit new to wxPython, so I hope this isn't a stupid
question. :slight_smile:

I have an application that I want to display A/D readings. I've created
a wxPanel containing a wxStaticText control; I have an idle event
handler that reads an A/D channel, performs some calculations and
updates the text control.

The problem is that this produces horrible flicker. I've tried changing
the wxStaticText object to a wxTextCtrl but that doesn't seem to make
any difference at all. I've tried putting a small delay at the end of
the event handler and that seems to help some, but the flicker is still
very noticeable.

I'm using wxPython 2.4.2 on Debian Sarge and Microsoft WinXP... the
flicker is apparent on both platforms (a bit worse in Windows).

Again, I'm still getting my feet wet with wxPython, so maybe my whole
approach is misguided. I'd appreciate any comments or suggestions...
thanks in advance.

Hello... I'm still a bit new to wxPython, so I hope this isn't a stupid
question. :slight_smile:

Nobody is born omniscient.

I have an application that I want to display A/D readings. I've created
a wxPanel containing a wxStaticText control; I have an idle event
handler that reads an A/D channel, performs some calculations and
updates the text control.

The problem is that this produces horrible flicker. I've tried changing
the wxStaticText object to a wxTextCtrl but that doesn't seem to make
any difference at all. I've tried putting a small delay at the end of
the event handler and that seems to help some, but the flicker is still
very noticeable.

My guess is that somewhere a .Refresh() is called on the frame or on some big window and this produces the flickering.

I'm using wxPython 2.4.2 on Debian Sarge and Microsoft WinXP... the
flicker is apparent on both platforms (a bit worse in Windows).

Again, I'm still getting my feet wet with wxPython, so maybe my whole
approach is misguided. I'd appreciate any comments or suggestions...
thanks in advance.

try installing an empty handler for the EVT_ERASE_BACKGROUND

like in:

def DoNothing(*args, **kargs): pass

[...]

         EVT_ERASE_BACKGROUND(self, DoNothing)

where self is the target Frame or Window

路路路

On Wed, 03 Nov 2004 10:25:34 -0800, Jeffrey Hurt <jhurt@metriguard.com> wrote:

--
Peter Damoc
Hacker Wannabe

Thanks for the reply, but I'm still getting the flicker. :frowning:

路路路

On Wed, 2004-11-03 at 22:56, Peter Damoc wrote:

On Wed, 03 Nov 2004 10:25:34 -0800, Jeffrey Hurt <jhurt@metriguard.com> wrote:

> Hello... I'm still a bit new to wxPython, so I hope this isn't a stupid
> question. :slight_smile:

Nobody is born omniscient.

> I have an application that I want to display A/D readings. I've created
> a wxPanel containing a wxStaticText control; I have an idle event
> handler that reads an A/D channel, performs some calculations and
> updates the text control.
>
> The problem is that this produces horrible flicker. I've tried changing
> the wxStaticText object to a wxTextCtrl but that doesn't seem to make
> any difference at all. I've tried putting a small delay at the end of
> the event handler and that seems to help some, but the flicker is still
> very noticeable.

My guess is that somewhere a .Refresh() is called on the frame or on some big window and this produces the flickering.

> I'm using wxPython 2.4.2 on Debian Sarge and Microsoft WinXP... the
> flicker is apparent on both platforms (a bit worse in Windows).
>
> Again, I'm still getting my feet wet with wxPython, so maybe my whole
> approach is misguided. I'd appreciate any comments or suggestions...
> thanks in advance.

try installing an empty handler for the EVT_ERASE_BACKGROUND

like in:

def DoNothing(*args, **kargs): pass

[...]

         EVT_ERASE_BACKGROUND(self, DoNothing)

where self is the target Frame or Window

It might be that updating your text control in your idle event is the
culprit, as it may simply send an overwhelming number of refresh calls to
the screen.

Try to devise a way to detect when the control needs to be updated and only
update it when it needs it, but not when nothing has changed.

Alternately, use a timer to update the control less frequently than the idle
event updates it, say every half second or every tenth of a second or
whatever.

David

路路路

-----Original Message-----
From: Jeffrey Hurt [mailto:jhurt@metriguard.com]
Sent: Thursday, November 04, 2004 1:40 PM
To: wxPython-users@lists.wxwidgets.org
Subject: Re: [wxPython-users] Newbie Question

On Wed, 2004-11-03 at 22:56, Peter Damoc wrote:
> On Wed, 03 Nov 2004 10:25:34 -0800, Jeffrey Hurt > <jhurt@metriguard.com> wrote:
>
> > Hello... I'm still a bit new to wxPython, so I hope this
isn't a stupid
> > question. :slight_smile:
>
> Nobody is born omniscient.
>
> > I have an application that I want to display A/D readings.
I've created
> > a wxPanel containing a wxStaticText control; I have an idle event
> > handler that reads an A/D channel, performs some calculations and
> > updates the text control.
> >
> > The problem is that this produces horrible flicker. I've
tried changing
> > the wxStaticText object to a wxTextCtrl but that doesn't seem to make
> > any difference at all. I've tried putting a small delay at the end of
> > the event handler and that seems to help some, but the
flicker is still
> > very noticeable.
>
> My guess is that somewhere a .Refresh() is called on the frame
or on some big window and this produces the flickering.
>
> > I'm using wxPython 2.4.2 on Debian Sarge and Microsoft WinXP... the
> > flicker is apparent on both platforms (a bit worse in Windows).
> >
> > Again, I'm still getting my feet wet with wxPython, so maybe my whole
> > approach is misguided. I'd appreciate any comments or suggestions...
> > thanks in advance.
>
> try installing an empty handler for the EVT_ERASE_BACKGROUND
>
> like in:
>
> def DoNothing(*args, **kargs): pass
>
> [...]
>
> EVT_ERASE_BACKGROUND(self, DoNothing)
>
> where self is the target Frame or Window

Thanks for the reply, but I'm still getting the flicker. :frowning:

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org