[python-win32] Issues with tkinter, COM servers and Python 3.x

Tim Roberts timr at probo.com
Mon May 18 19:26:23 CEST 2015


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.



More information about the python-win32 mailing list