def METHOD_NAME(screen_size, period, binary):
    xv = numpy.indices((screen_size[1], screen_size[0]))[1]
    sine_xv = 127.5 + 127.5*numpy.sin(xv * 2.0 *  numpy.pi * period)
    numpy_image = numpy.ascontiguousarray(sine_xv, dtype = numpy.uint8)
    if binary:
        mask = (numpy_image < 128)
        numpy_image[mask] = 0
        numpy_image[~mask] = 255
    image = QtGui.QImage(numpy_image.data, screen_size[0], screen_size[1], QtGui.QImage.Format_Indexed8)
    image.np_data = numpy_image
    for i in range(256):
        image.setColor(i,QtGui.qRgb(i,i,i))
    return image