from time import sleep
from monitor.camera import Camera
from monitor.plotter_pygame import PyGamePlotter


def run(plotter, camera):

    while True:
        plotter.show(camera.get_image_data())
        sleep(1.0)

if __name__ == "main":

    cam_ioc = "X1-CAM"

    plo = PyGamePlotter()
    cam = Camera(cam_ioc)

    run(plo, cam)

import sys
from time import sleep
from camera import Camera
from plotter_pygame import PyGamePlotter


def run(plotter, camera):
    old_timestamp = -1
    while True:
        data, timestamp = camera.get_image_data()
        if timestamp != old_timestamp:
            plotter.show(data)
            old_timestamp = timestamp
        sleep(1.0)

if __name__ == "__main__":

    cam_ioc = sys.argv[1]  # "X1-CAM"

    cam = Camera(cam_ioc)
    plo = PyGamePlotter()
    plo.set_screensize(cam.xsize, cam.ysize)

    run(plo, cam)

Update to set screensize and take camera IOC as arg
Update to set screensize and take camera IOC as arg

+ import sys
  from time import sleep
- from monitor.camera import Camera
+ from camera import Camera
- from monitor.plotter_pygame import PyGamePlotter
+ from plotter_pygame import PyGamePlotter
  
  
  def run(plotter, camera):
- 
+     old_timestamp = -1
      while True:
-         plotter.show(camera.get_image_data())
+         data, timestamp = camera.get_image_data()
+         if timestamp != old_timestamp:
+             plotter.show(data)
+             old_timestamp = timestamp
          sleep(1.0)
  
- if __name__ == "main":
+ if __name__ == "__main__":
  
-     cam_ioc = "X1-CAM"
+     cam_ioc = sys.argv[1]  # "X1-CAM"
  
+     cam = Camera(cam_ioc)
      plo = PyGamePlotter()
-     cam = Camera(cam_ioc)
+     plo.set_screensize(cam.xsize, cam.ysize)
  
      run(plo, cam)
  
Update to set screensize and take camera IOC as arg
## Code Before:
from time import sleep
from monitor.camera import Camera
from monitor.plotter_pygame import PyGamePlotter


def run(plotter, camera):

    while True:
        plotter.show(camera.get_image_data())
        sleep(1.0)

if __name__ == "main":

    cam_ioc = "X1-CAM"

    plo = PyGamePlotter()
    cam = Camera(cam_ioc)

    run(plo, cam)

## Instruction:
Update to set screensize and take camera IOC as arg
## Code After:
import sys
from time import sleep
from camera import Camera
from plotter_pygame import PyGamePlotter


def run(plotter, camera):
    old_timestamp = -1
    while True:
        data, timestamp = camera.get_image_data()
        if timestamp != old_timestamp:
            plotter.show(data)
            old_timestamp = timestamp
        sleep(1.0)

if __name__ == "__main__":

    cam_ioc = sys.argv[1]  # "X1-CAM"

    cam = Camera(cam_ioc)
    plo = PyGamePlotter()
    plo.set_screensize(cam.xsize, cam.ysize)

    run(plo, cam)
