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: canvas.create_box() crashes Tk thread
Type: Stage:
Components: Tkinter Versions:
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: akuchling, loewis, rasfahan
Priority: normal Keywords:

Created on 2002-10-22 15:54 by rasfahan, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Messages (6)
msg12913 - (view) Author: T. Koehler (rasfahan) Date: 2002-10-22 15:54
Frequently, but apparently not depending on the
paramters passed, the following exception will be
thrown, and Tk will stop responding while the
interpreter continues to run. This is on Windows (95,
98, 2000), under linux, the problem does not occur.
All parameters passed have int-values, we checked that
first.
The exception can be caught via a try-statement, but Tk
will stop responding anyway.

---snip
    self.rectangle
=self.canvas.create_rectangle(self.x,self.y+1,self.x2,self.y
2-1)
  File "D:\PYTHON21\lib\lib-tk\Tkinter.py", line 1961,
in create_rectangle
    return self._create('rectangle', args, kw)
  File "D:\PYTHON21\lib\lib-tk\Tkinter.py", line 1939,
in _create
    (self._w, 'create', itemType)
ValueError: invalid literal for int(): None
---snap
msg12914 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2002-10-22 17:03
Logged In: YES 
user_id=21627

Can you please investigate this a little bit further? Split
the return statement in _create into several parts

  command = (self._w, 'create', itemType) + args + \
     self._options(cnf, kw)
  print command
  result = apply(self.tk.call, command)
  print result
  return getint(result)

It seems that result will become None. This, in turn, is
quite impossible: tk.app.call will never return None.
msg12915 - (view) Author: T. Koehler (rasfahan) Date: 2002-10-23 11:09
Logged In: YES 
user_id=634021

Ok, here's the output of the last two print-statements
before the exception from getint(). To me it looks as if the
tk.app.call actually did return None.
('.8476780.13726076.8520076', 'create', 'rectangle', 50, 3,
250, \
13, '-fill', '#00FF00')
None
msg12916 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2002-10-23 13:40
Logged In: YES 
user_id=21627

As I said, this is difficult to understand, since _tkinter has no 
return Py_None in the relevant code: it might be memory 
corruption in an completely unrelated module.

Are you using any funny extension modules?

Can you post a self-contained example that might allow me 
to reproduce the problem?

Could you try to debug the associated C code in a debugger?
I.e. set a breakpoint onto the single return in Tkapp_Call (the 
USING_OBJECTS version), and conditionalize it on 
res==Py_None. Then inspect the state of the Tcl interp.

Sorry I can't be of more help.
msg12917 - (view) Author: T. Koehler (rasfahan) Date: 2002-10-23 18:29
Logged In: YES 
user_id=634021

So far, I have failed to produce the bug in a small
code-snippet. We use no library that isn't included in the
standard python downloads, and the bug is reproducible with
all 2.x versions. The create_rectangle call is located in
another thread (created with thread.start_new_thread),
though, than the   
Tk.mainloop of the root window of the canvas - might that be
a problem?
Unfortunatly, I do not have access to a debugger/c-compiler
for windows, except for cygwin, where the problem does not
exist.
msg12918 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2004-06-05 22:05
Logged In: YES 
user_id=11375

No discussion in 18 months; closing this bug.
History
Date User Action Args
2022-04-10 16:05:46adminsetgithub: 37358
2002-10-22 15:54:39rasfahancreate