Hi,

You could use the time module.

import time

while 1:
    time.sleep(5)      # freezes for 5 s
    update plot

This should be less CPU consuming ...

lpmp



On Thu, Nov 8, 2012 at 9:41 AM, francesco oteri
<francesco.ot...@gmail.com>wrote:

> Hi,
> what about opening-closing  the file every now and then, for example every
> 5seconds?
> you can do it using the function time(). It gives you the amount of time
> since I don't kno when,
> but you can count how many seconds are left using:
>
> a=time()
> while 1:
>      b=time()
>      left= b-a
>      if left == 5sec:
>         updating plot
>
> Actually is very cpu consuming, but it is the best I can propose :(
>
>
> Francesco
>
>
>
> 2012/11/8 Sebastian Rhode <sebrh...@gmail.com>
>
>> Hi,
>>
>> I have a textfile where every second a line is written. Usually the look
>> like this:
>>
>> 1; 124; 455
>>
>> a second later
>>
>> 1; 124; 455
>> 2; 104; 600
>>
>> ...
>>
>> Finally such a file is quite easy to plot using matplotlib. But what
>> would be very useful for me is a script, that is watching the TXT file and
>> updates the plot when a new row "arrives". Any good ideas?
>>
>> Cheers,
>>
>> Sebi
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Everyone hates slow websites. So do we.
>> Make your web apps faster with AppDynamics
>> Download AppDynamics Lite for free today:
>> http://p.sf.net/sfu/appdyn_d2d_nov
>> _______________________________________________
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>
>
> --
> Cordiali saluti, Dr.Oteri Francesco
>
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_d2d_nov
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_nov
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to