[Pythonmac-SIG] Re: Tkinter questions
Russell E. Owen
rowen at cesmail.net
Fri Feb 27 15:06:28 EST 2004
In article <9FB060A2-68B5-11D8-83FF-000A956870AC at wisc.edu>,
Kenneth McDonald <kmmcdonald at wisc.edu> wrote:
> I've been told that that Aqua version of Tck/Tk is rather buggy; so, I
> would like to have the X11 version installed also, so that if I run
> into problems, I can check to see if they are related to AquaTk or not.
> Is there a set of instructions for doing this and avoiding pitfalls?
>
> Also, more generally, is there a good mailing list for Tkinter
> questions? I haven't seen one in the list on the Python web site.
>
> Finally, I'll ask a quick Tkinter question here, even though it's not
> the right place, because it's really got me hung up on my
> project--sorry. I'm subclassing the Text widget, and want to override
> the default keybindings; however, I don't actually want to change the
> keybindings for Text widgets as a whole. My problem is that when I bind
> a keystroke to a function in my subclass, the binding operated
> correctly, but the keystroke is then passed up along the event chain,
> and the default Text action is also executed. Looking through the Tcl
> documentation, I see there's a command (break--I think?) which is
> specifically for breaking off the default event handling so this does
> not occur, but I have no idea how to call this through Tkinter, or if
> it is even possible. Anyone know? Any other suggestions as to how to
> accomplish this? I did try to unbind the event on my text widget before
> rebinding it, but that doesn't work--my understanding is that the
> default bindings are associated with the Tk Text class, not instances,
> so unbinding them would affect all text widgets.
I agree Aqua Tk has some bugs, but I still find it usable. Personally I
suggest you start there.
Still...it is possible to have both Aqua Tk and X11 Tk. One approach:
- Download unix source for Tck, Tk and Python.
- Install each in turn as if for unix (i.e. ignore any mac-specific
instructions).
- Modify your PATH to include /usr/local/bin. If you want to be able to
type "python" to run this unix python, make sure /usr/local/bin comes
before /usr/bin; an alternative is to define a special alias to run this
version of python.
I am sure this works because it is how I run all the time (I run Tkinter
apps under both X11 and Aqua Tk).
The down sides are:
- You'll have two completely different versions of python on your
machine, so if you use any extension packages, you'll probably want to
install them separately for both versions.
- You don't get Package Manager for the unix python.
An alternative is to try Jack Jensen's solution. If you build all that
stuff I mentioned you'll get an X11 _tkinter.so. So it doesn't save any
time setting things up, but it saves the hassles mentioned above
becausee you'll only be using the built in python. I haven't yet tried
it; I guess I should, but I hate to mess with what aint broke.
-- Russell
More information about the Pythonmac-SIG
mailing list