Commits

Thomas Kluyver  committed 2e34d78

Make interval a global variable, for easier changing.

  • Participants
  • Parent commits 70a4b07

Comments (0)

Files changed (1)

File rliveevents.py

 the plot window is resized. Use the start() and stop() functions to turn
 updates on and off.
 
-Importing the module currently starts updates.
+The interval variable determines how often updates are performed. The default
+is every 0.2 seconds.
+
+Importing the module will automatically start updates.
 """
 from rpy2.rinterface import process_revents
 import time
     def __init__(self):
         super(_ReventThread, self).__init__()
         self.running = True
-        self.interval = 0.2
         
     def stop(self):
         self.running = False
                 process_revents()
             except RuntimeError:
                 pass
-            time.sleep(self.interval)
+            time.sleep(interval)
 
 _eventthread = _ReventThread()
+interval = 0.2
 
-def start(interval=0.2):
-    """Start running continuous updates of plots etc. Specifying interval
-    defines how often it will update. The default is every 0.2 seconds.
-    
-    If updates are already running, this will just change the interval."""
+def start():
+    """Start running continuous updates of plots etc. If updates are already
+    running, this has no effect."""
     global _eventthread
-    _eventthread.interval = interval
     if _eventthread.is_alive():
         return
     _eventthread.start()