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: Cannot play solitaire - buggy Canvas.py?
Type: Stage:
Components: Tkinter Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: gvanrossum Nosy List: alburt, gvanrossum
Priority: normal Keywords:

Created on 2001-03-31 11:59 by alburt, last changed 2022-04-10 16:03 by admin. This issue is now closed.

Messages (4)
msg4140 - (view) Author: Alastair Burt (alburt) Date: 2001-03-31 11:59
To test tkinter in my newly installed Python 2.0, I
tried Demos/tkinter/guido/soliatire.py. This bombed
with the following message:
Traceback (most recent call last):
  File "solitaire.py", line 637, in ?
    main()
  File "solitaire.py", line 632, in main
    game = Solitaire(root)
  File "solitaire.py", line 570, in __init__
    self.deck.fill()
  File "solitaire.py", line 412, in fill
    self.add(Card(suit, value, self.game.canvas))
  File "solitaire.py", line 295, in add
    card.tkraise()
  File "solitaire.py", line 200, in tkraise
    self.group.tkraise()
  File
"/home/burt/lib/python/lib/python2.0/lib-tk/Canvas.py",
line 177, in tkraise
    self._do('tag_raise', aboveThis)
  File
"/home/burt/lib/python/lib/python2.0/lib-tk/Canvas.py",
line 131, in _do
    return self.canvas._do(cmd, (self.tag,) +
_flatten(args))
  File
"/home/burt/lib/python/lib/python2.0/lib-tk/Tkinter.py",
line 1771, in _do
    return self.tk.call((self._w, name) + args)
TclError: bad option "tag_raise": must be addtag, bbox,
bind, canvasx, canvasy, cget, configure, coords,
create, dchars, delete, dtag, find, focus, gettags,
icursor, index, insert, itemcget, itemconfigure, lower,
move, postscript, raise, scale, scan, select, type,
xview, or yview

I managed to fix this with the following kludge to
Canvas.py:

*** Canvas.py	2001/03/31 10:55:24	1.1
--- Canvas.py	2001/03/31 11:38:12
***************
*** 170,180 ****
  	def config(self, cnf={}, **kw):
  		return self.canvas.itemconfigure(self.tag,
_cnfmerge((cnf,kw)))
  	def lower(self, belowThis=None):
! 		self._do('tag_lower', belowThis)
  	def move(self, xAmount, yAmount):
  		self._do('move', xAmount, yAmount)
  	def tkraise(self, aboveThis=None):
! 		self._do('tag_raise', aboveThis)
  	lift = tkraise
  	def scale(self, xOrigin, yOrigin, xScale, yScale):
  		self._do('scale', xOrigin, yOrigin, xScale, yScale)
--- 170,180 ----
  	def config(self, cnf={}, **kw):
  		return self.canvas.itemconfigure(self.tag,
_cnfmerge((cnf,kw)))
  	def lower(self, belowThis=None):
! 		self._do('lower', belowThis)
  	def move(self, xAmount, yAmount):
  		self._do('move', xAmount, yAmount)
  	def tkraise(self, aboveThis=None):
! 		self._do('raise', aboveThis)
  	lift = tkraise
  	def scale(self, xOrigin, yOrigin, xScale, yScale):
  		self._do('scale', xOrigin, yOrigin, xScale, yScale


--- Alastair
msg4141 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2001-04-10 15:50
Logged In: YES 
user_id=6380

I bet that demo is broken, not the Canvas module, but I have
no time to fix this before the 2.1 release.

Use PySol if you want to play. :-)
msg4142 - (view) Author: Alastair Burt (alburt) Date: 2001-04-10 16:02
Logged In: YES 
user_id=45573

The demo might be the only piece of software in the world
that tickles this bug but I think it is not the real
culprit. There is a mismatch between the interface offered
by lib-tk/Tkinter.py and that used by lib-tk/Canvas.py which
is the result of name changes related to "tag_lower" and
"tag_raise".
msg4143 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2001-04-10 21:14
Logged In: YES 
user_id=6380

You're right!  Thanks for persisting.  I've fixed this now.
History
Date User Action Args
2022-04-10 16:03:55adminsetgithub: 34260
2001-03-31 11:59:45alburtcreate