mirror of
https://github.com/python/cpython.git
synced 2025-09-27 10:50:04 +00:00
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).
This commit is contained in:
parent
56af4448e1
commit
da65450530
1 changed files with 4 additions and 4 deletions
|
@ -61,6 +61,8 @@ _default_root = None
|
||||||
def NoDefaultRoot():
|
def NoDefaultRoot():
|
||||||
global _support_default_root
|
global _support_default_root
|
||||||
_support_default_root = 0
|
_support_default_root = 0
|
||||||
|
global _default_root
|
||||||
|
_default_root = None
|
||||||
del _default_root
|
del _default_root
|
||||||
|
|
||||||
def _tkerror(err):
|
def _tkerror(err):
|
||||||
|
@ -931,8 +933,8 @@ class Tk(Misc, Wm):
|
||||||
print 'execfile', `base_py`
|
print 'execfile', `base_py`
|
||||||
execfile(base_py, dir)
|
execfile(base_py, dir)
|
||||||
def report_callback_exception(self, exc, val, tb):
|
def report_callback_exception(self, exc, val, tb):
|
||||||
import traceback
|
import traceback, sys
|
||||||
print "Exception in Tkinter callback"
|
sys.stderr.write("Exception in Tkinter callback\n")
|
||||||
traceback.print_exception(exc, val, tb)
|
traceback.print_exception(exc, val, tb)
|
||||||
|
|
||||||
# Ideally, the classes Pack, Place and Grid disappear, the
|
# Ideally, the classes Pack, Place and Grid disappear, the
|
||||||
|
@ -1042,8 +1044,6 @@ class BaseWidget(Misc):
|
||||||
if not _default_root:
|
if not _default_root:
|
||||||
_default_root = Tk()
|
_default_root = Tk()
|
||||||
master = _default_root
|
master = _default_root
|
||||||
if not _default_root:
|
|
||||||
_default_root = master
|
|
||||||
self.master = master
|
self.master = master
|
||||||
self.tk = master.tk
|
self.tk = master.tk
|
||||||
name = None
|
name = None
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue