1 | n/a | import unittest |
---|
2 | n/a | from test import support |
---|
3 | n/a | |
---|
4 | n/a | # Skip this test if _tkinter wasn't built. |
---|
5 | n/a | support.import_module('_tkinter') |
---|
6 | n/a | |
---|
7 | n/a | # Skip test if tk cannot be initialized. |
---|
8 | n/a | support.requires('gui') |
---|
9 | n/a | |
---|
10 | n/a | import tkinter |
---|
11 | n/a | from _tkinter import TclError |
---|
12 | n/a | from tkinter import ttk |
---|
13 | n/a | from tkinter.test import runtktests |
---|
14 | n/a | |
---|
15 | n/a | root = None |
---|
16 | n/a | try: |
---|
17 | n/a | root = tkinter.Tk() |
---|
18 | n/a | button = ttk.Button(root) |
---|
19 | n/a | button.destroy() |
---|
20 | n/a | del button |
---|
21 | n/a | except TclError as msg: |
---|
22 | n/a | # assuming ttk is not available |
---|
23 | n/a | raise unittest.SkipTest("ttk not available: %s" % msg) |
---|
24 | n/a | finally: |
---|
25 | n/a | if root is not None: |
---|
26 | n/a | root.destroy() |
---|
27 | n/a | del root |
---|
28 | n/a | |
---|
29 | n/a | def test_main(): |
---|
30 | n/a | support.run_unittest( |
---|
31 | n/a | *runtktests.get_tests(text=False, packages=['test_ttk'])) |
---|
32 | n/a | |
---|
33 | n/a | if __name__ == '__main__': |
---|
34 | n/a | test_main() |
---|