Re: Idle handler only runs after an event?

Kevin Altis <[email protected]> Thu, 23 Oct 2008 10:24:59 -0700
Newsgroups gmane.comp.python.pythoncard
Message-ID <[email protected]>
In wx terms, idle just means the event queue has emptied, which is  
why you see "idle" events occurring when you move the mouse. Using an  
on_idle handler in PythonCard is one way of updating your UI as it  
allows you to do some processing without worrying about whether an  
event generated from a sizer, window resize or some other update is  
still processing.

For an application using threads such as yours you'll be better  
served by using a timer event. There are numerous examples of this in  
the samples as well as a timers-threads.html documentation at http:// 
pythoncard.sourceforge.net/timers-threads.html

You can use a timer that fires more often than you require for  
processing along with a flag to prevent running code within your  
program unless it is required. For example, in the worldclock  
example, the text on screen isn't updated unless the time has changed.

I'm sure some folks would be interested in seeing your program if you  
want to provide a link.

ka

On Oct 23, 2008, at 7:00 AM, Christopher Lees wrote:

> Hi all.
>
> I'm just writing a GUI frontend in Pythoncard that uses queues to
> communicate between threads. The Idle handler reads the queue and
> updates some information in the GUI.
>
> The issue I'm finding is that the GUI information only updates when I
> move the mouse within the Pythoncard window. I don't know if it's just
> the GUI that's not updating, or if the Idle handler isn't actually
> running.
>
> Is this a known issue? Is there any sort of viable workaround? I am
> running Ubuntu 8.04 with both libwxbase2.6.3.2 and libwxbase2.8.7
> installed, Pythoncard 0.8.1-8, Xorg 7.3, and Python 2.5.2. I can  
> provide
> any other information you want or need.
>
> For those interested, it's a frontend for a CLI program I wrote that
> converts video files to the correct format for Sony Walkman MP3  
> players.
> Uses multiple cores as well!
>
> Chris
>
>
> ---------------------------------------------------------------------- 
> ---
> This SF.Net email is sponsored by the Moblin Your Move Developer's  
> challenge
> Build the coolest Linux based applications with Moblin SDK & win  
> great prizes
> Grand prize is a trip for two to an Open Source event anywhere in  
> the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Pythoncard-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/pythoncard-users


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/