[python-win32] Issues with tkinter, COM servers and Python 3.x
Diego Vélez Torres
divelez69 at gmail.com
Mon May 18 21:49:43 CEST 2015
Hi Tim:
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? 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?
Best regards,
2015-05-18 12:26 GMT-05:00 Tim Roberts <timr at probo.com>:
> Diego Vélez Torres wrote:
> > Hi:
> >
> > I'm having issues with tkinter, COM servers and Python 3.4. I can't
> > call tkinter inside a COM server. I tried many examples of tkinter,
> > but every time I try to init a tkniter instance ( tk = tkinter.Tk()
> > ) inside a running COM server, the same following error arises:
> >
> > tk = Tk()
> > File "C:\Python34\Lib\tkinter\__init__.py", line 1851, in __init__
> > self.tk <http://self.tk> = _tkinter.create(screenName, baseName,
> > className, interactive, wantobjects, useTk, sync, use)
> > TypeError: must be str, not bytes
>
> Interesting. The signature in the source code requires screenName,
> baseName, className, and use to be strings, but only screenName and use
> are optional. className is not actually used -- the source overrides
> it. As an experiment, can you change your code to this:
> tk = Tk( baseName='xxx' )
> and see what happens?
>
> --
> Tim Roberts, timr at probo.com
> Providenza & Boekelheide, Inc.
>
> _______________________________________________
> python-win32 mailing list
> python-win32 at python.org
> https://mail.python.org/mailman/listinfo/python-win32
>
--
Diego Vélez Torres
divelez69 at gmail.com
Teléfono: 098 28 57 58
Cuenca, Ecuador
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20150518/1ea81e60/attachment.html>
More information about the python-win32
mailing list