[SOLVED] run panda without DirectStart

Hi all,
I’m trying to make a network game, but i’d like the server part to run in the background, and i dont know how to start the taskMgr without DirectStart.

I’ve tried

from direct.showbase.MessengerGlobal import *
from direct.showbase.Messenger import *
from direct.task.TaskManagerGlobal import *
from direct.task.Task import Task




but i get thir error : NameError: global name ‘messenger’ is not defined

Is there a way to import all necessary modules and run panda without opening a window ?


You could just put this before the DirectStart import:

from pandac.PandaModules import loadPrcFileData
loadPrcFileData("", "window-type none")
from direct.directbase import DirectStart

Then you won’t have a window, but still be able to access things like the messenger.

:smiley: , thanks a lot,
i knew there must have a simple solution, but dont know where to search.

I’ve got a similar problem. I’m trying to create a program to automatically create cubemaps:

from pandac.PandaModules import loadPrcFileData
loadPrcFileData("", "window-type none")
from direct.showbase.ShowBase import ShowBase
import sys

class MyApp(ShowBase):
    def __init__(self):
        # The basics
        scene = self.loader.loadModel("models/environment")
        scene.set_scale(0.25, 0.25, 0.25)
        scene.set_pos(-8, 42, 0)
        base.saveCubeMap('grassy_#.jpg', size = 512)
app = MyApp()

However, setting window-type to none, not only does the window not get created, but also the default camera:

Traceback (most recent call last):
  File "create_cubemap.py", line 19, in <module>
    app = MyApp()
  File "create_cubemap.py", line 15, in __init__
AttributeError: 'NoneType' object has no attribute 'set_pos'

You can’t create cube maps without anything to render into. You should set the window type to “offscreen” if you really don’t want a window.