I am trying to use Tkinter in the Blender Python interface.
from Tkinter import * # this works
root = Tk() # this complains about "argv" not being part of "sys" ie:
Traceback (most recent call last):
File "Text", line 11, in ?
File "/usr/lib/python2.2/lib-tk/Tkinter.py", line 1483, in __init__
baseName = os.path.basename(sys.argv[0])
AttributeError: 'module' object has no attribute 'argv'
I can run the same stuff under a python shell with no errors even though both Blender and the shell are using "/usr/bin/python".
I also noticed Blender.sys does not have argv. Am I missing something very basic?
Thanks,
Demolishun
Well I figured out how to use Tkinter in Blender. It seems that Blender modifies the Python shell so that the "sys" object is not the same as the "sys" object under a regular Python shell. This false sys object does not have a "argv" variable in it. So in order to get it to work I lied to it:
sys.argv = "Some Text' # This is not really correct, but it works.
This has allowed me to execute a Tkinter script and pop up a window on top of Blender. It is not perfect, but it works. I hope to fix some of the scripts that relied on the GUI object to do thier work.
I do have another question:
Is there a way to save the contents of the Text window to another file other than ".blend"? I have looked at all the docs I can find and it does not mention this.
Thanks,
Demolishun
tried to do x = tkinter.Tk() after importing and no window appears
please help