From: Fabien L. <laf...@gm...> - 2011-12-12 15:16:55
|
Hi David! Sorry about the delay I was abroad and without any way to connect to the internet. Thank you very much. I've tried to put the principal inside the timerEvent. It work but it lags. In fact I've set the interval of the Timer to 2 seconds because the principal loop takes roughly 2seconds but it's not very accurate... Is there a way to do the principal loop, show it on the screen, then redo the loop? Thanks again! Fabien 2011/12/5 David Hoese <dh...@gm...>: > If I'm understanding your question correctly and reading your code correctly, you're asking why the timer method of doing things works, but the principal() while loop method does not. > > I had a couple solutions that involved the main event loop, but I just noticed 2 main things that are probably wrong with your code: > 1. You are calling 'principal' from inside __init__ so you never actually return from __init__ which means that you never call "window.show()" and therefore never call "qApp.exec_()". If you really want to use the 'principal' method you would have to connect it to a one shot timer anyway to have it run after you have started the application ('qApp.exec_()'). I think the recommended way would be to use the timer the way you did in your latest email. > > 2. At least in the way my email client reads your original code, your calls to the matplotlib drawing functions aren't inside the while loop and the while loop never ends...although this doesn't matter if you don't fix #1 above. > > Hope that made sense. > > -Dave > > > On 12/5/11 1:44 PM, mat...@li... wrote: >> Message: 3 >> Date: Mon, 5 Dec 2011 15:46:02 +0100 >> From: Fabien Lafont<laf...@gm...> >> Subject: Re: [Matplotlib-users] [ploting data] Live data >> Cc:mat...@li... >> Message-ID: >> <CAC9H_cjrgQBE6e6+jzZHyfYHonTeAg0XwU7c_2G-hu=s+...@ma...> >> Content-Type: text/plain; charset=ISO-8859-1 >> >> Thx all for your remarks, >> >> I can't understand why this code works (when I use the timer method): > > > ------------------------------------------------------------------------------ > All the data continuously generated in your IT infrastructure > contains a definitive record of customers, application performance, > security threats, fraudulent activity, and more. Splunk takes this > data and makes sense of it. IT sense. And common sense. > http://p.sf.net/sfu/splunk-novd2d > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |