mirror of
https://github.com/python/cpython.git
synced 2025-08-01 15:43:13 +00:00
[3.9] bpo-42630: Improve error reporting in Tkinter for absent default root (GH-23781) (GH-23853)
* Tkinter functions and constructors which need a default root window
raise now RuntimeError with descriptive message instead of obscure
AttributeError or NameError if it is not created yet or cannot
be created automatically.
* Add tests for all functions which use default root window.
* Fix import in the pynche script.
(cherry picked from commit 3d569fd6dc
)
This commit is contained in:
parent
d458d8dab0
commit
87e7a14ee3
19 changed files with 316 additions and 87 deletions
|
@ -6,7 +6,7 @@ import sys
|
|||
|
||||
from tkinter.test.test_ttk.test_functions import MockTclObj
|
||||
from tkinter.test.support import (AbstractTkTest, tcl_version, get_tk_patchlevel,
|
||||
simulate_mouse_click)
|
||||
simulate_mouse_click, AbstractDefaultRootTest)
|
||||
from tkinter.test.widget_tests import (add_standard_options, noconv,
|
||||
AbstractWidgetTest, StandardOptionsTests, IntegerSizeTests, PixelSizeTests,
|
||||
setUpModule)
|
||||
|
@ -1860,12 +1860,22 @@ class SizegripTest(AbstractWidgetTest, unittest.TestCase):
|
|||
def create(self, **kwargs):
|
||||
return ttk.Sizegrip(self.root, **kwargs)
|
||||
|
||||
|
||||
class DefaultRootTest(AbstractDefaultRootTest, unittest.TestCase):
|
||||
|
||||
def test_frame(self):
|
||||
self._test_widget(ttk.Frame)
|
||||
|
||||
def test_label(self):
|
||||
self._test_widget(ttk.Label)
|
||||
|
||||
|
||||
tests_gui = (
|
||||
ButtonTest, CheckbuttonTest, ComboboxTest, EntryTest,
|
||||
FrameTest, LabelFrameTest, LabelTest, MenubuttonTest,
|
||||
NotebookTest, PanedWindowTest, ProgressbarTest,
|
||||
RadiobuttonTest, ScaleTest, ScrollbarTest, SeparatorTest,
|
||||
SizegripTest, SpinboxTest, TreeviewTest, WidgetTest,
|
||||
SizegripTest, SpinboxTest, TreeviewTest, WidgetTest, DefaultRootTest,
|
||||
)
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue