Commit Graph

185 Commits

Author SHA1 Message Date
Guido van Rossum 42405a5d7d A version of FixTk.py that works with the way the installer now
installs Tcl/Tk.
2000-03-31 03:11:40 +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 d5062babed Moshe Zadka:
Added docstrings to tkSimpleDialog.py
2000-02-24 15:01:43 +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 ea7364c7cd Peter Haight discovered that this code uses a mutable default for cnf
and then (under certain circumstances) can clobber the default!
He also submitted this patch as PR#82.
1999-09-20 00:39:47 +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 7ea8f8404c Break some cycles when the widget is destroyed. 1999-06-25 15:53:54 +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 b241b67b89 Turtle graphics 1998-12-04 16:42:46 +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 3179b36014 When no master widget is specified, use options['parent'] if it exists. 1998-10-12 20:40:47 +00:00
Guido van Rossum 7f20263349 Only reference Tkinter._default_root when needed. 1998-10-12 20:40:09 +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
Barry Warsaw 4cbe3876ec NSEW is also valid for -sticky 1998-10-01 15:54:48 +00:00
Barry Warsaw 9190046289 Added NS and EW constants, which are meaningful values for grid's
-sticky option.
1998-10-01 13:49:37 +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 3d16d3e643 Fredrik Lundh's font wrapper. 1998-08-11 19:07:58 +00:00
Guido van Rossum b4750db3b3 Added coords() and identify() methods to Scale class. 1998-08-11 19:07:14 +00:00
Guido van Rossum 2b427c74e1 Nannified. 1998-08-10 20:13:17 +00:00
Guido van Rossum 5ff1761d3f From: "Fredrik Lundh" <fredrik@pythonware.com>
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.
1998-08-07 14:55:21 +00:00
Guido van Rossum 93d1fe1c56 From: Nicolas CHAUVAT <nico@caesium.fr>
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'))
1998-07-16 13:43:05 +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
Fred Drake 073b829021 When a file name is selected ("OK" button, <Return> in the filename entry),
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.
1998-05-06 17:28:23 +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
Guido van Rossum e86271af72 When setting the event structure fields, don't die when the widget
name is not registered; simply use the string.  This happens for
tear-off widgets (e.g. if you've registered enter/leave events for the
menu).
1998-04-27 19:32:59 +00:00