0

I want to add some GUI without simulating 2D Controls in 3D, and I think Tkinter module is easy enough to use. I set up a simple scene to try my idea, but it seems not work. enter image description here Neither import tkinter nor import Tkinter, as I tried out, works probably. Any suggestions? Thanks.

Page David
  • 171
  • 8
  • only standard python modules are included in blender, not sure this will work but you can install python and force Blender to use it over the bundled one. –  Jun 07 '16 at 03:32
  • @root how to make blender use a certain environment? – Page David Jun 07 '16 at 03:39
  • by default blender will try to use the system installed python, installing python will put it's installation path in the PATH environment variable and blender reads this variable at startup, also the python version you install must be the same version like the one blender has. I'm not exactly sure though ,maybe you can ask a question about this. –  Jun 07 '16 at 03:43
  • @root should I try to add /usr/bin/env to PATH? – Page David Jun 07 '16 at 03:49
  • here is your answer. I hope it helps –  Jun 07 '16 at 03:50
  • 1
    @root Sorry, I am rendering an animation, I don't want to interrupt it, I will try out this method after it is finished.(it seems to be work). Thanks. – Page David Jun 07 '16 at 03:55
  • @root Recently, I found I can install python package into my workplace with pip3 install --target <directory> <package-name>. That will take away more spaces from disk maybe, but it is more convenient to share projects with others. – Page David Aug 20 '16 at 03:35

1 Answers1

0

Tkinter will freeze your game and create a popup window, which is probably not what you want. You could install it, but I wouldn't suggest it.

I've found that making simple interfaces is harder in code (eg tkinter) than it is in BGE with objects. Of course, by the time you want combo boxes, you probably want a GUI library. And these libraries do exist. There is a nice one called BGUI you should look into. This writes into openGL ontop of BGE, so it won't freeze your game or create external windows.

sdfgeoff
  • 1,982
  • 1
  • 11
  • 13