Background color does not appear on screenshot when using window-type offscreen

Hello! I am trying to understand how I can set a background on my scene before taking a screenshot

from direct.showbase.ShowBase import ShowBase

from panda3d.core import loadPrcFileData
loadPrcFileData("", "window-type offscreen" ) # Spawn an offscreen buffer
loadPrcFileData("", "audio-library-name null" ) # Prevent ALSA errors

class Demo(ShowBase):

    def __init__(self):

        sample = loader.loadModel("panda")
        sample.set_pos(0, 50, 0)

        # Does not appear to work when using "window-type offscreen"
        base.setBackgroundColor(1, 0, 1, 0.5)

demo = Demo()

Thanks in advance for your help.

what image are you receiving?
if I comment rows with “panda” model loading I get image filled with pink color as


Does it help if you call renderFrame twice after changing the background colour?