0
$\begingroup$

So,I wanted some Opengl text in the 3d viewport (in Blender 2.79b )and decided to run the python script from blender's website which comes in the blf module (https://docs.blender.org/api/2.79/blf.html?highlight=font%20drawing) . I ran the script in the text editor and the script failed to load .When I ran the script from the console I was suprised to find this error - ImportError: No module named 'bge' .How is this possible?

import game engine modules

from bge import render Traceback (most recent call last): File "", line 1, in ImportError: No module named 'bge'

from bge import logic Traceback (most recent call last): File "", line 1, in ImportError: No module named 'bge'

$\endgroup$
  • $\begingroup$ Clearly states example is for game engine. bge is only available for import when running the game engine. Look at _text editor > templates > python > operator modal draw_ for an example of overlaying text on blender UI with blfand bgl $\endgroup$ – batFINGER Oct 21 '18 at 3:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.