Re: RE: Tk for Windows (also NT)

Brennan Hildebrand (brennan@tfs.com)
Thu, 23 Mar 1995 00:33:58 GMT


I've been working, over the last couple of days, on getting
TkNt36r5 integrated with python. It's been a little difficult.

I'm using python-1.1.1 with the new python NT stuff put up
last week by Mark Hammond.

This is a small list of what I went through:

I got TkNt36r5 working out of the box. No changes there, it
worked just fine.

After that came the python integration.
I found that I had problems using Tk/Tcl/lxlib in dll form. For
some reason my Tk routines weren't being properly mapped into
memory. I decided that I would create static libraries instead.
This almost worked.

I found a couple of things:

It seems that the NT stuff uses the main in Python/frozenmain.c
instead of config_nt.c

tkintermodule.c has a problem where it calls getprogramname in
Tkinter_Create as a parameter to strrchr. Because of the
compilation of config.c into two separate objects, argv0 isn't
defined in the scope that Tkinter_Create is calling from, and
thus is null. So, it passes a NULL pointer to strchr, which
proceeds to "dump core".

I fixed this by moving getprogramname out of the strchr call,
checking to see if the result is NULL, and if so, forces it to
"python". This way the strchr doesn't fail.

Once I got this fixed, python was able to run the tkinter
scripts, but no windows were ever opened. After poking around
in Tk and the xlib for nt package that comes with it, I
discovered that the CreateWindow call was failing because the
class was unregistered. This wasn't being caught because the
return result wasn't being checked.

I finally managed to get windows to be opened on the screen by
adding some initialization routines to PyInit_Tkinter which
registered the window classes needed for TkNt with windows (NT).

The problem now is that the window sizing is wrong. The windows
are as small as they can be, and can't be resized.

Has anyone managed to get Tkinter running under NT before? If
so, I could use any suggestions you have.

If not, I'll be happy to make my changes available to anyone who
is interested.

Oh, all this works under Windows 95 as well.

Thanks,
-brennan
brennan@tfs.com