2009-01-28 09:09:03 -04:00
|
|
|
import os
|
2009-03-26 18:30:10 -03:00
|
|
|
import unittest
|
2009-01-28 09:09:03 -04:00
|
|
|
from test import test_support
|
|
|
|
|
2014-05-02 12:33:49 -03:00
|
|
|
# Skip this test if _tkinter wasn't built or gui resource is not available.
|
2009-03-31 15:32:17 -03:00
|
|
|
test_support.import_module('_tkinter')
|
2014-05-02 12:33:49 -03:00
|
|
|
test_support.requires('gui')
|
2009-03-31 15:32:17 -03:00
|
|
|
|
2011-07-04 01:52:35 -03:00
|
|
|
this_dir = os.path.dirname(os.path.abspath(__file__))
|
|
|
|
lib_tk_test = os.path.abspath(os.path.join(this_dir, os.path.pardir,
|
|
|
|
'lib-tk', 'test'))
|
|
|
|
|
|
|
|
with test_support.DirsOnSysPath(lib_tk_test):
|
|
|
|
import runtktests
|
|
|
|
|
2014-08-24 03:07:09 -03:00
|
|
|
import Tkinter as tkinter
|
2009-03-31 15:32:17 -03:00
|
|
|
import ttk
|
2009-03-30 16:04:00 -03:00
|
|
|
from _tkinter import TclError
|
|
|
|
|
2014-08-24 03:07:09 -03:00
|
|
|
root = None
|
2009-01-28 15:28:04 -04:00
|
|
|
try:
|
2014-08-24 03:07:09 -03:00
|
|
|
root = tkinter.Tk()
|
|
|
|
button = ttk.Button(root)
|
|
|
|
button.destroy()
|
|
|
|
del button
|
|
|
|
except TclError as msg:
|
2009-01-28 15:28:04 -04:00
|
|
|
# assuming ttk is not available
|
2009-03-26 17:48:25 -03:00
|
|
|
raise unittest.SkipTest("ttk not available: %s" % msg)
|
2014-08-24 03:07:09 -03:00
|
|
|
finally:
|
|
|
|
if root is not None:
|
|
|
|
root.destroy()
|
|
|
|
del root
|
2009-01-28 15:28:04 -04:00
|
|
|
|
2014-06-02 18:01:16 -03:00
|
|
|
def test_main():
|
2009-10-17 11:40:54 -03:00
|
|
|
with test_support.DirsOnSysPath(lib_tk_test):
|
2014-08-24 03:07:09 -03:00
|
|
|
test_support.run_unittest(
|
|
|
|
*runtktests.get_tests(text=False, packages=['test_ttk']))
|
2009-01-28 09:09:03 -04:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
2014-06-02 18:01:16 -03:00
|
|
|
test_main()
|