Using Tkinter in Blender Python

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

Post Reply
Posts: 6
Joined: Mon Feb 17, 2003 1:41 am

Using Tkinter in Blender Python

Post by demolishun » Tue Feb 18, 2003 6:42 am

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/", 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?


Posts: 6
Joined: Mon Feb 17, 2003 1:41 am

Update:Using Tkinter in Blender Solved & Another Questio

Post by demolishun » Wed Feb 19, 2003 5:27 am

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.


Posts: 20
Joined: Wed Oct 16, 2002 2:29 pm

Post by Schlops » Wed Feb 19, 2003 2:32 pm


Posts: 3
Joined: Sat Mar 09, 2013 3:35 am

tkinter does not work with python and blender

Post by levinemartin100 » Sat Mar 09, 2013 3:50 am

tried to do x = tkinter.Tk() after importing and no window appears
please help

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest