Python's logolike module turtle.py did not display
the turtle except when actually drawing lines.
This patch changes the turtle.py module so that
it displays the turtle at all times when tracing is
on. This is similar to the the way that logo works.
When tracing is off the turtle will not be displayed.
comments, docstrings or error messages. I fixed two minor things in
test_winreg.py ("didn't" -> "Didn't" and "Didnt" -> "Didn't").
There is a minor style issue involved: Guido seems to have preferred English
grammar (behaviour, honour) in a couple places. This patch changes that to
American, which is the more prominent style in the source. I prefer English
myself, so if English is preferred, I'd be happy to supply a patch myself ;)
this patch adds a fast _flatten function to the _tkinter
module, and imports it from Tkinter.py (if available).
this speeds up canvas operations like create_line and
create_polygon. for example, a create_line with 5000
vertices runs about 50 times faster with this patch in
place.
OptionMenu is modified. Somewhat rewritten and elaborated by myself.
class _setit: The constructor now takes an optional argument
`callback' and stashes this in a private variable. If set, the
__call__() method will invoke this callback after the variable's value
has changed. It will pass the callback the value, followed by any
args passed to __call__().
class OptionMenu: The constructor now takes keyword arguments, the
only one that's legally recognized is `command', which can be set to a
callback. This callback is invoked when the OptionMenu value is set.
Any other keyword argument throws a TclError.
and Toplevel class constructors. This means that if the window
manager closes the window, the Python-side Tkinter data structures
will be destroyed correctly. (Most apps do this anyway, and it's
recommended practice; I see no reason why making it the default
behavior could be bad.)
bindings to a dictionary _tagcommands which was otherwise unused.
(This was checked in accidentally with rev. 1.125 and not deleted with
rev. 1.127 when the other half of this code was removed -- although
even as originally checked in the _tagcommands variable was never
used.)
(PR#40, reported by Peter Stoehr)
than was worth it: when deleting a canvas item, it would try to
automatically delete the bindings for that item. Since there's
nothing that says you can't reuse the tag and still have the bindings,
this is not correct. Also, it broke at least one demo
(Demo/tkinter/matt/rubber-band-box-demo-1.py).
so the preferred name for them is tag_lower, tag_raise
(similar to tag_bind, and similar to the Text widget);
unfortunately can't delete the old ones yet (maybe in 1.6)
An attempt to execute grid_slaves with arguments (0,0) results in
*all* of the slaves being returned, not just the slave associated with
row 0, column 0. This is because the test for arguments in the method
does not test to see if row (and column) does not equal None, but
rather just whether is evaluates to non-false. A value of 0 fails
this test.
in autoexec.bat in order to find the Tcl DLLs -- Tkinter calls FixTk
which will hunt around in a few common places and then set PATH
and try again, or else issue a big clarifying error message.
assign the exception info to sys.last_{type,value,traceback}. That
way, an introspective Tkinter app can inspect its own stack trace.
(The controversy is that it would keep some objects alive, but that's
probably no big deal.)
Fix bug in NoDefaultRoot() -- _default_root wasn't declared global;
and made it reentrant.
Don't set _default_root to whatever master gets passed in to
BaseWidget._setup() (only set it when we need to create a new Tk()
widget).
Date: Fri, 7 Aug 1998 13:37:12 +0100
the "initialcolor" code is broken in several places in the
current version of tkColorChooser. I've attached an up-
dated version for 1.5.2.
In the bbox method of Group (Canvas.py file), you should read
return self.canvas._getints(self._do('bbox'))
instead of
return self._getints(self._do('bbox'))
and the "key" keyword parameter was used to invoke .go(), use the directory
of the selected file as the stored directory to return to when the same key
is used again. This is useful since the user may well entry at least part
of the path in the filename box instead of doing a lot of clicking around in
the listboxes.
wm_title(), etc. The old names (title() etc.) are still defined as
aliases.
This brings all methods up to use the same naming convention: whether
the Tcl syntax is
.window.path.name command subcommand [options]
or
command subcommand .window.path.name [optins]
the Python equivalent is always
windowobject.command_subcommand(options)
calling self.tk.getint() and self.tk.getdouble(), call the globals
getint() and getdouble(), which in turn are just names for the Python
builtins int() and double(). (Making them globals actually save a
dict lookup compared to using the built-in.) The corresponding
methods of class Misc have been changed similarly. (Note that
getboolean() hasn't been changed because there's no Python
equivalent.)
The use of int() and float() has another advantage: if/when Tcl calls
can actually return Tcl objects with other types than string, use of
int() and float() is essential.
not needed to say apply(self.tk.call, t); self.tk.call(t) has the same
effect. This cuts down tremendously on the number of apply() calls
made. No measurable effect, but at the very least it saves the lookup
of apply() in the globals!
* The invoke methods of the three Tkinter widgets Button,
Checkbutton and Radiobutton should return the value returned by
the callback, (like the Menu widget does):
def invoke(self):
return self.tk.call(self._w, 'invoke')
* The select_from method of the Canvas widget should use 'from', not
'set':
def select_from(self, tagOrId, index):
self.tk.call(self._w, 'select', 'from', tagOrId, index)
Currently, if you use select_from, you get the error message:
'TclError: bad select option "set": must be adjust, clear, from, item, or to'
* The 'entrycget' and 'type' methods of the Tk menu widget are
missing from Tkinter.
* There is a bug in grid_columnconfigure and grid_rowconfigure. For
example, this should return the current value of the 'minsize'
option for column 0:
f.grid_columnconfigure(0, 'minsize')
Instead it returns the same as:
f.grid_columnconfigure(0)
I suggest that the hint given in the comment in the
Tkinter.Misc.configure method should be followed - "ought to
generalize this so tag_config etc. can use it". Repeating the
same configure code several times in Tkinter is inviting errors.
[I did not follow this advice --G]
* The grid_slaves method should handle options. Currently, to pass
options to the grid_slaves method, you have to do something like:
grid_slaves('-row', 1)
All geometry manager methods that apply to a master widget instead of
to a slave widget have been moved to the Misc class, which is
inherited by all of Tk(), Toplevel() and Widget(). They have been
renamed to have their geometry manager name as a prefix,
e.g. pack_propagate(); the short names can still be used where
ambiguities are resolved so that pack has priority over place has
priority over grid (since this was the old rule).
Also, the method definitions in the Pack, Place and Grid classes now
all have their respective geometry manager name as a prefix
(e.g. pack_configure); the shorter names are aliases defined through
assignment.
A similar renaming has been done for all config() methods found
elsewhere; these have been renamed to configure() with config being
the alias (instead of the other way around). (This may not make much
of a difference but the official Tk command name is now 'configure'
and it may help in debugging tracebacks.)
Finally, a new base class BaseWidget has been introduced, which
implements the methods common between Widget and Toplevel (the
difference between those two classes is that Toplevel has a different
__init__() but also that Toplevel doesn't inherit from Pack, Place or
Grid.
was all that the method set anyway). Removed calls to the
constructor. This reduces the number of Python function calls
per widget construction by one, for every widget construction.
not exist. All 8 uses of tkinter are replaced with _tkinter. Still
create a variable tkinter though, because that is used by other
modules importing Tkinter (e.g. tkinter.createfilehandler()).
Also added a comment to the 'import _tkinter' line saying that if this
fails, Python is not configured correctly.
to Frame(w, cnf={"class": "classname"}). I think this is the only
widget other than Toplevel that needs to be concerned about setting
the widget's class (-class must be the first option on the Tcl
widget creation command).
- When dragging the mouse in either listbox, the *first* entry
clicked on is selected rather than the last (but the last one is
highlighted).
This is done by changing the bindtags so that our binding is executed
after the default binding (which sets the 'active' index to the last
item selected), and using 'active' instead of 'anchor' as the index to
ask for.
Tk 4.2. The new winfo options supported are: mananger, pointerx,
pointerxy, pointery, server, viewable, visualid, visualsavailable.
Also fixed bugs in winfo_colormapfull() and winfo_containing().
selection interface, handle the -displayof option intelligently in
many places. Added "wm colormapwindows" and "winfo colormapfull"
support. Removed "focus default" and "focus none" method: these are
not in Tk 4.X.
- Support ~[user] expansion.
- Remember last directory and pattern; optional 'key' argument
specifies different memory locations.
- Absolutify pathnames if possible.
- WM close event cancels the dialog.
- First arg to go() can be either a directory or a file (renamed to
dir_of_file); defaults to current directory.
* Setup.in: moreButtons Tk extension support (again).
* mklibapp: $1 is now the path to the Tk extension source
directory. The default is /usr/local/src/tcl.
* kill.py: Don't use the exec Tcl command.
* Tkinter.py
(Misc.bind_all): Bug fix; extra graves.
(Misc.tk_strictMotif): Return the value.
(mainloop, getint, getdouble, getboolean): New functions.
(_cnfmerge): Flatten cnfs.
Wed Jun 29 22:01:17 1994 Steen Lumholt (lumholt@login.dkuug.dk)
* Tkinter.py:
(Tk.destroy): master is always None; so don't del. Found by
Tommy Burnette, solution from Guido van Rossum.
(Misc.selection_get): Missing return. Found by Richard Neitzel.
(Misc._options, Widget.config, Canvas._create): If cnf is a tuple
or list then merge the contents. Suggested by Matthew Conway.