Ejemplo n.º 1
0
    def run():

        # Create the default Panda3d instances as subprocesses.
        # Since panda3dmanager is global, the instances are accessible
        # through it from everywhere.
        panda3dmanager.getPanda3dInstance("editor")
        panda3dmanager.getPanda3dInstance("game")

        # Now initialize the GUI in the current process.
        app = wx.App()
        app.SetAppName("Panity")
        app.SetClassName("Panity")
        frame = PanityFrame()
        frame.Show()

        # Keep the global message server ticking, so that we can communicate
        # with the subprocesses.
        frame.messageserver_timer = wx.Timer(frame)
        frame.Bind(wx.EVT_TIMER, messageserver.process, frame.messageserver_timer)
        frame.messageserver_timer.Start(1000.0/60) # 60 times a second

        # Same for the clients in the panda3dmanager.
        frame.messageclients_timer = wx.Timer(frame)
        frame.Bind(wx.EVT_TIMER, panda3dmanager.process, frame.messageclients_timer)
        frame.messageclients_timer.Start(1000.0/60)

        app.MainLoop()
Ejemplo n.º 2
0
    def __init__(self, p3d_name, *args, **kwargs):
        wx.Panel.__init__(self, *args, **kwargs)

        self.p3d_name = p3d_name
        self.p3dinstance = panda3dmanager.getPanda3dInstance(p3d_name)
        self.messageclient = self.p3dinstance.messageclient
        self.messageclient.addListener(self.UImessageProcessor, UI)
        # The window is is set in initialize.
        self.window_id = None

        # See __doc__ of initialize() for this callback.
        self.GetTopLevelParent().Bind(wx.EVT_SHOW, self._onShow)