This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: "Bare" text tag_configure in Tkinter
Type: Stage:
Components: Tkinter Versions:
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: loewis Nosy List: loewis, sreeves
Priority: normal Keywords: patch

Created on 2002-09-21 18:50 by sreeves, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
tkinter-tag_configure.diff sreeves, 2002-09-21 18:50 Patch for "bare" Tkinter tag_configure bug
tkinter-configure.diff sreeves, 2002-09-23 19:11 Patch to generalize Tkinter widget *configure methods
Messages (6)
msg41188 - (view) Author: Steve Reeves (sreeves) Date: 2002-09-21 18:50
In Tcl/Tk, doing a "tag configure" operation on a text
widget with only a tag name as argument returns all of
the attributes configured for that tag. The analogous
tag_configure method in Tkinter returns nothing.

The attached patch fixes this.

I'm using Python 2.1, but the same bug is in 2.2 as
well. Here is a typescript showing the results of the
analogous commands in Tcl/Tk and Tkinter:

  $ wish
  % text .t
  .t
  % .t tag configure someTag -foreground red
  % .t tag configure someTag -foreground
  -foreground {} {} {} red
  % .t tag configure someTag
  {-background {} {} {} {}} {-bgstipple {} {} {} {}}
{-borderwidth {} {} 0 {}} {-elide {} {} 0 {}}
{-fgstipple {} {} {} {}} {-font {} {} {} {}}
{-foreground {} {} {} red} {-justify {} {} {} {}}
{-lmargin1 {} {} {} {}} {-lmargin2 {} {} {} {}}
{-offset {} {} {} {}} {-overstrike {} {} {} {}}
{-relief {} {} {} {}} {-rmargin {} {} {} {}} {-spacing1
{} {} {} {}} {-spacing2 {} {} {} {}} {-spacing3 {} {}
{} {}} {-tabs {} {} {} {}} {-underline {} {} {} {}}
{-wrap {} {} {} {}}
  % ^D
  $ python
  Python 2.1.3 (#1, Sep  7 2002, 15:29:56)
  [GCC 2.95.4 20011002 (Debian prerelease)] on linux2
  Type "copyright", "credits" or "license" for more
information.
  >>> import Tkinter
  >>> root = Tkinter.Tk()
  >>> t = Tkinter.Text(root)
  >>> t.tag_configure('someTag', foreground='red')
  >>> t.tag_configure('someTag', 'foreground')
  ('foreground', '', '', '', 'red')
  >>> t.tag_configure('someTag')
  >>> ^D
  $ 

msg41189 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2002-09-21 20:35
Logged In: YES 
user_id=21627

I may be missing something, but shouldn't tag_configure
return a dictionary in this case? See the widget's configure
for comparison.
msg41190 - (view) Author: Steve Reeves (sreeves) Date: 2002-09-21 21:38
Logged In: YES 
user_id=2647

Oops, yeah, it should return a dictionary.  Now I also see
the comment in configure() about generalizing it so
tag_configure() can use it too.
msg41191 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2002-09-22 11:34
Logged In: YES 
user_id=21627

So would you like to produce a new patch in that direction?
msg41192 - (view) Author: Steve Reeves (sreeves) Date: 2002-09-23 19:11
Logged In: YES 
user_id=2647

Here is a revised patch that generalizes configure() into a
new internal function _configure().  This is then used by
Misc.configure, Canvas.itemconfigure, Listbox.itemconfigure,
Menu.entryconfigure, Text.image_configure,
Text.tag_configure and Text.window_configure.

BTW, the Text widget's image_configure and window_configure
had the same bug as tag_configure in not returning anything
for a "bare" call.
msg41193 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2002-10-10 14:37
Logged In: YES 
user_id=21627

Thanks for the patch. Committed as

Tkinter.py 1.164;
ACKS 1.208;
NEWS 1.497;
History
Date User Action Args
2022-04-10 16:05:41adminsetgithub: 37201
2002-09-21 18:50:39sreevescreate