Diego Vélez Torres wrote:
>
> I just fixed the issue by applying your advise. But (...and here comes
> a big BUT !!!), why do I have to do this when calling tkinter inside a
> COM server, meanwhile this is not necessarily when outside a COM?
You shouldn't. I'm sure this is a bug, but it would take some digging
to assign blame and come up with a fix. If you don't pass a baseName,
the code in tkinter.__init__.py tries to create one from sys.argv[0].
In a COM server, there may not be a clear value in sys.argv[0]. The
call will fail is baseName ends up None; my guess is that's what is
happening.
> If my COM Server were using tkinter directly I could rely on this
> trick. However, my originally problem came up by trying to use pyplot
> from Matplotlib. I found that pyplot.figure() launches a tk
> instance. Therefore, in order to use this library (and any other that
> uses tkinter) within COMs, I must modify the source codes. It doesn't
> seem this to be a feasible solution. Is there any other solution?
You should be able to modify lib\tkinter\__init.py, and just before the
call at line 1851 insert this:
if baseName is None:
baseName = 'xxx'
--
Tim Roberts, [email protected]
Providenza & Boekelheide, Inc.
_______________________________________________
python-win32 mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-win32