import("rocket"); return null

Discussion about using Python with libRocket.

import("rocket"); return null

Postby lpa on Wed Sep 11, 2013 9:41 am

Hi,
I have a problème, i try to use librocket with ogre3d and python for event but that not work for me :cry:
librocket work fine without python.
I use the master version of librocket, python 2.7 and boost 1.54.0 with vs express 2010

My python interface:
Code: Select all
    GuiPythonInterface::GuiPythonInterface()
   {
      Py_Initialize();


      const char* python_path = Py_GetPath();
      char buffer[1024];
      snprintf(buffer, 1024, "media/gui/python/;%s", python_path);
      buffer[1023] = '\0';
      PySys_SetPath(buffer);

      // Import Rocket.
      import("rocket");
      import("sys");
      import("csv");
   }

   bool GuiPythonInterface::import(const Rocket::Core::String& name)
   {
   
      PyObject* module = PyImport_ImportModule(name.CString());
      if (!module) {
         PrintError(true);
         
         char buffer[1024];
         snprintf(buffer, 1024, "Unable to load the py script:%s", name.CString());
         Engine::getSingletonPtr()->log(buffer);
         
         return false;
      }

      Py_DECREF(module);
      
      return true;
   }


That is where i construct the python interface
Code: Select all
   
Gui::Gui(void)
   {
      
      BuildKeyMaps();

      Engine::getSingletonPtr()->log("*** Oga::Gui intenced ***");

      // Rocket initialisation.
      Ogre::RenderWindow* window = Engine::getSingletonPtr()->getWindow();
      ogre_renderer = new GuiRenderInterface(window->getWidth(), window->getHeight());
      Rocket::Core::SetRenderInterface(ogre_renderer);

      ogre_system = new GuiSystemInterface();
      Rocket::Core::SetSystemInterface(ogre_system);

      Rocket::Core::Initialise();
      Rocket::Controls::Initialise();

      mGuiPythonInterface = new GuiPythonInterface();

      mContext = Rocket::Core::CreateContext("main", Rocket::Core::Vector2i(window->getWidth(), window->getHeight()));
      Rocket::Debugger::Initialise(mContext);
   }


import("rocket"); return false

the two follow module are well imported ?
import("sys");
import("csv");

anyone have an idea of the problem ? thank you
lpa
 
Posts: 1
Joined: Wed Sep 11, 2013 9:27 am

Re: import("rocket"); return null

Postby sami125 on Wed Nov 06, 2013 7:09 am

I have a problème, i try to use librocket with ogre3d and python for event but that not work for me :cry:
librocket work fine without python.
Sami
sami125
 
Posts: 1
Joined: Wed Nov 06, 2013 6:58 am


Return to libRocket and Python


cron