If you've ever tried to use tkinter from stealth you've probably found that it gives you a strange and bad error.
I'll try to make a sample to explain.
This is very basic sample that will run in a clean python 3.2 environment:
from tkinter import *
class App:
def __init__(self, master):
frame = Frame(master)
frame.pack()
self.hi_there = Button(frame, text="Hello", command=self.say_hi)
self.hi_there.pack(side=LEFT)
def say_hi(self):
print ("hi there, everyone!")
root = Tk()
app = App(root)
root.mainloop()
If you run it int stealth you'll get this error:
16:04:58:079 []: File "C:\Python32\Lib\tkinter\__init__.py", line 1669, in __init__
baseName = os.path.basename(sys.argv[0])
AttributeError: 'module' object has no attribute 'argv'
So the only way you have to go is to force sys.argv to an empty list:
from tkinter import *
import sys
class App:
def __init__(self, master):
frame = Frame(master)
frame.pack()
self.hi_there = Button(frame, text="Hello", command=self.say_hi)
self.hi_there.pack(side=LEFT)
def say_hi(self):
print ("hi there, everyone!")
sys.argv = [""]
root = Tk()
app = App(root)
root.mainloop()
I think this is a bug in stealth, but in the way showed before you can bypass it.

Thanks to Crome969 that pointed out the problem and gave me an idea on how to solve it.
