Commit Graph

152 Commits

Author SHA1 Message Date
Eric S. Raymond fc170b1fd5 String method conversion. 2001-02-09 11:51:27 +00:00
Fred Drake 132dce2246 Update the code to better reflect recommended style:
Use != instead of <> since <> is documented as "obsolescent".
Use "is" and "is not" when comparing with None or type objects.
2000-12-12 23:11:42 +00:00
Fred Drake d038ca830f Make reindent.py happy (convert everything to 4-space indents!). 2000-10-23 18:31:14 +00:00
Fred Drake d2a5ad25d5 Removed some debugging prints: When running user configuration code
from Tk.readprofile(), do not print anything extra to stdout, just run
the code.
2000-09-15 04:41:22 +00:00
Martin v. Löwis 0d8ce6111c Fix for bug 110629: Generate unique image names by introducing a counter 2000-09-08 16:28:30 +00:00
Fredrik Lundh a249f16af0 Older Tk versions don't support mousewheel support. Set event.delta
to zero if that's the case (closes bug #113727)
2000-09-07 15:05:09 +00:00
Fredrik Lundh 24037f735f -- don't mess up in winfo_visualsavailable if the system only
supports a single visual (closes bug #110603)
2000-08-09 19:26:47 +00:00
Fredrik Lundh 289ad8f063 -- added optional newstate argument to Wm.state. The newstate arg
was added in Tk 8.3 (this fixes the first part of Bug #110605)
2000-08-09 19:11:59 +00:00
Fredrik Lundh 8fffa208e0 -- use explicit conversion instead of u-string literal in the test
code, to make the new Tkinter.py run under 1.5.2
-- changed Text.yview argument name (for consistency with xview)
2000-08-09 18:51:01 +00:00
Fredrik Lundh 5bd2cd663d -- added xview_moveto, xview_scroll, yview_moveto, yview_scroll
to the Text method (closes Bug #110605)
2000-08-09 18:29:51 +00:00
Fredrik Lundh 06d2815350 -- untabification (use "diff -b" to verify) 2000-08-09 18:03:12 +00:00
Thomas Wouters 7e47402264 Spelling fixes supplied by Rob W. W. Hooft. All these are fixes in either
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 ;)
2000-07-16 12:04:32 +00:00
Guido van Rossum 0a3f7978c4 Change whitespace in two places to silence tabnanny.
Also fix spelling tupel -> tuple.
2000-07-06 05:34:14 +00:00
Guido van Rossum 5917ecb0a4 Nils Fischbeck: added doc strings to everything. Martin von Loewis
has reviewed this, too.
2000-06-29 16:30:50 +00:00
Andrew M. Kuchling e475e70128 Patch from /F:
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.
2000-06-18 18:45:50 +00:00
Guido van Rossum 2ab9082a07 Show Tcl/Tk version number in _test() and show Unicode test if possible. 2000-03-30 23:19:44 +00:00
Guido van Rossum 0ba33002e1 Fix a typo in Barry's checkin.
Reported both by Gerrit Holl and Mark Favas.
2000-02-27 15:35:47 +00:00
Barry Warsaw 7d3f27c090 Changes inspired by Randall Hooper to allow callbacks when an
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.
2000-02-25 21:54:19 +00:00
Guido van Rossum 8fa42af978 Fix PR#107: wm_colormapwindows() did the wrong thing when presented
more than one window argument.
1999-10-20 12:29:56 +00:00
Guido van Rossum f8d8e07601 Fixed PR#106: winfo_visualsavailable() with the includeids=1 option
didn't properly handle the hex numbers returned.
1999-10-18 22:06:38 +00:00
Guido van Rossum e61e98d2ae Add calls to self.protocol("WM_DELETE_WINDOW", self.destroy) to the Tk
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.)
1999-08-20 18:26:06 +00:00
Guido van Rossum 42b334d93d Remove some redundant code from Canvas.tag_bind(), which added all
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)
1999-07-30 12:22:12 +00:00
Guido van Rossum 1a03cf56e0 Greg McFarlane submitted two missing Text methods: mark_next() and
mark_previous().
1999-06-21 14:13:30 +00:00
Guido van Rossum fa8c3eab79 Greg McFarlane writes: Tkinter.Text.tag_add should take multiple
arguments.  [Slightly changed from submitted patch.]
1999-06-01 13:57:15 +00:00
Guido van Rossum 8e40759d5a Nathan Paul Simons noticed that the grid_remove() method was missing.
(The difference between grid_remove() and grid_forget() is that the
former remembers the options for the slave.)
1999-05-05 23:03:48 +00:00
Guido van Rossum 6e9dadc1da Delete an accidentally checked-in feature that actually broke more
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).
1999-04-08 14:46:06 +00:00
Guido van Rossum 0d8d3dd5b0 lower, tkraise/lift hide Misc.lower, Misc.tkraise/lift,
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)
1999-04-07 16:25:54 +00:00
Guido van Rossum eb354b31e5 Bug reported by Jim Robinson:
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.
1999-03-16 21:54:50 +00:00
Guido van Rossum c55b0ca601 Put a try-except around the "image delete" call in Image.__del__ to
avoid tracebacks when the root is destroyed before the image object.
1999-02-08 15:26:49 +00:00
Guido van Rossum f8d579c5e3 This hopefully fixes the problem of having to set PATH
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.
1999-01-04 18:06:45 +00:00
Guido van Rossum dfaac4df9e Add XXX comment about the need to add a dump() method to the Text
widget -- no time to do this right now.
1998-12-21 18:25:03 +00:00
Barry Warsaw 107e623ef0 grid_bbox(): support new Tk API: grid bbox ?column row? ?column2 row2? 1998-12-15 00:44:15 +00:00
Guido van Rossum 9f1292d840 Perhaps a controversial change: when reporting a callback exception,
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.)
1998-10-13 20:02:39 +00:00
Barry Warsaw 4eaadf002e Added {xview,yview}_{moveto,scroll} to the Canvas class. 1998-10-13 19:01:10 +00:00
Guido van Rossum 243ac4f497 Updated listbox methods to Tk 8.0. (Moved some around, added
x/yview_scroll/moveto.)
1998-10-13 13:37:30 +00:00
Guido van Rossum da65450530 The message "Exception in Tkinter callback" should go to stderr.
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).
1998-10-06 19:06:27 +00:00
Guido van Rossum 0c92000b7a Ignore the TclError exception raised when deleting the registration
for callit, used by the after() command.  This can happen when the
callback deletes the window.
1998-09-14 19:06:39 +00:00
Guido van Rossum c86b7c63e0 Make bind variants without a sequence return a tuple of sequences
(formerly it returned a string, which wasn't very convenient).

Add image commands to the Text widget (these are new in Tk 8.0).
1998-08-31 16:54:33 +00:00
Guido van Rossum b4750db3b3 Added coords() and identify() methods to Scale class. 1998-08-11 19:07:14 +00:00
Fred Drake 182c590869 Tk.__init__(): In computing baseName, add ".pyo" to list of dropped
extensions, and include the "." in ".pyc".  Still need to get
	_tkinter.c:Tkapp_New() to use baseName....
1998-07-15 04:36:56 +00:00
Guido van Rossum 88b63b8d30 Allow binding a Tcl command (given as a string) as well as a Python
function.
1998-06-25 18:54:49 +00:00
Guido van Rossum cef4c844df Turns out that 'winfo id' returns the id as a hex string, with 0x prefix.
The int() function (aliased to getint()) doesn't handle that, so we must
use self.tk.getint() again...
1998-06-19 04:35:45 +00:00
Guido van Rossum 268824e089 Different trick to get the _test() window to pop up. 1998-06-19 04:34:19 +00:00
Guido van Rossum fe02efdbf4 getint() now raises ValueError, not TclError, on errors. 1998-06-09 02:37:45 +00:00
Guido van Rossum 0bd5433cf8 Get rid of nearly all clals to self._do -- turns out self.tk.call can
be used just as well, so this saves one Python call in many cases!
1998-05-19 21:18:13 +00:00
Guido van Rossum e365a590d4 Change the names of all methods in the Wm class: they are now
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)
1998-05-01 19:48:20 +00:00
Guido van Rossum 0132f69c2e Another optimization, probably of negligeable effect: instead of
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.
1998-04-30 17:50:36 +00:00
Guido van Rossum dc59340646 In _bind(), found a way to test for break without a temp variable. 1998-04-29 22:16:57 +00:00
Guido van Rossum f975699c07 Save a tiny bit of time: self.tk.call takes a tuple argument so it's
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!
1998-04-29 21:57:08 +00:00
Guido van Rossum f0c891a2b2 Import MacOS at the top instead of insize Tk.__init__() -- the latter
repeats the I/O for the failed import on each interpreter creation.
1998-04-29 21:43:36 +00:00