def test_tabs(self): widget = self.create() if get_tk_patchlevel() < (8, 5, 11): self.checkParam(widget, 'tabs', (10.2, 20.7, '1i', '2i'), expected=('10.2', '20.7', '1i', '2i')) else: self.checkParam(widget, 'tabs', (10.2, 20.7, '1i', '2i')) self.checkParam(widget, 'tabs', '10.2 20.7 1i 2i', expected=('10.2', '20.7', '1i', '2i')) self.checkParam(widget, 'tabs', '2c left 4c 6c center', expected=('2c', 'left', '4c', '6c', 'center')) self.checkInvalidParam(widget, 'tabs', 'spam', errmsg='bad screen distance "spam"', keep_orig=tcl_version >= (8, 5))
def test_tabs(self): widget = self.create() if get_tk_patchlevel() < (8, 5, 11): self.checkParam(widget, 'tabs', (10.2, 20.7, '1i', '2i'), expected=('10.2', '20.7', '1i', '2i')) else: self.checkParam(widget, 'tabs', (10.2, 20.7, '1i', '2i')) self.checkParam(widget, 'tabs', '10.2 20.7 1i 2i', expected=('10.2', '20.7', '1i', '2i')) self.checkParam(widget, 'tabs', '2c left 4c 6c center', expected=('2c', 'left', '4c', '6c', 'center')) self.checkInvalidParam(widget, 'tabs', 'spam', errmsg='bad screen distance "spam"', keep_orig=tcl_version >= (8, 5))
def test_paneconfigure_width(self): p, b, c = self.create2() self.check_paneconfigure(p, b, 'width', 10, 10, stringify=get_tk_patchlevel() < (8, 5, 11)) self.check_paneconfigure_bad(p, b, 'width', 'bad screen distance "badValue"')
def test_tabs(self): widget = self.create() if get_tk_patchlevel() < (8, 5, 11): self.checkParam(widget, "tabs", (10.2, 20.7, "1i", "2i"), expected=("10.2", "20.7", "1i", "2i")) else: self.checkParam(widget, "tabs", (10.2, 20.7, "1i", "2i")) self.checkParam(widget, "tabs", "10.2 20.7 1i 2i", expected=("10.2", "20.7", "1i", "2i")) self.checkParam(widget, "tabs", "2c left 4c 6c center", expected=("2c", "left", "4c", "6c", "center")) self.checkInvalidParam( widget, "tabs", "spam", errmsg='bad screen distance "spam"', keep_orig=tcl_version >= (8, 5) )
# Common tests for test_tkinter/test_widgets.py and test_ttk/test_widgets.py import unittest import sys import Tkinter as tkinter from ttk import Scale from test_ttk.support import (AbstractTkTest, tcl_version, requires_tcl, get_tk_patchlevel, pixels_conv, tcl_obj_eq) import test.test_support noconv = noconv_meth = False if get_tk_patchlevel() < (8, 5, 11): noconv = str noconv_meth = noconv and staticmethod(noconv) def int_round(x): return int(round(x)) pixels_round = int_round if get_tk_patchlevel()[:3] == (8, 5, 11): # Issue #19085: Workaround a bug in Tk # http://core.tcl.tk/tk/info/3497848 pixels_round = int _sentinel = object() class AbstractWidgetTest(AbstractTkTest): _conv_pixels = staticmethod(pixels_round) _conv_pad_pixels = None
def test_paneconfigure_width(self): p, b, c = self.create2() self.check_paneconfigure(p, b, 'width', 10, 10, stringify=get_tk_patchlevel() < (8, 5, 11)) self.check_paneconfigure_bad(p, b, 'width', 'bad screen distance "badValue"')
# Common tests for test_tkinter/test_widgets.py and test_ttk/test_widgets.py import unittest import sys import Tkinter as tkinter from ttk import Scale from test_ttk.support import (AbstractTkTest, tcl_version, requires_tcl, get_tk_patchlevel, pixels_conv, tcl_obj_eq) import test.test_support noconv = noconv_meth = False if get_tk_patchlevel() < (8, 5, 11): noconv = str noconv_meth = noconv and staticmethod(noconv) def int_round(x): return int(round(x)) pixels_round = int_round if get_tk_patchlevel()[:3] == (8, 5, 11): # Issue #19085: Workaround a bug in Tk # http://core.tcl.tk/tk/info/3497848 pixels_round = int _sentinel = object() class AbstractWidgetTest(AbstractTkTest): _conv_pixels = staticmethod(pixels_round)