本文整理汇总了Python中Tkinter._join方法的典型用法代码示例。如果您正苦于以下问题:Python Tkinter._join方法的具体用法?Python Tkinter._join怎么用?Python Tkinter._join使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tkinter
的用法示例。
在下文中一共展示了Tkinter._join方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: checkParam
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import _join [as 别名]
def checkParam(self, widget, name, value, expected=_sentinel,
conv=False, eq=None):
widget[name] = value
if expected is _sentinel:
expected = value
if conv:
expected = conv(expected)
if self._stringify or not self.wantobjects:
if isinstance(expected, tuple):
expected = tkinter._join(expected)
else:
expected = str(expected)
if eq is None:
eq = tcl_obj_eq
self.assertEqual2(widget[name], expected, eq=eq)
self.assertEqual2(widget.cget(name), expected, eq=eq)
# XXX
if not isinstance(widget, Scale):
t = widget.configure(name)
self.assertEqual(len(t), 5)
self.assertEqual2(t[4], expected, eq=eq)
示例2: test_join
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import _join [as 别名]
def test_join(self):
join = tkinter._join
tcl = self.interp.tk
def unpack(s):
return tcl.call('lindex', s, 0)
def check(value):
self.assertEqual(unpack(join([value])), value)
self.assertEqual(unpack(join([value, 0])), value)
self.assertEqual(unpack(unpack(join([[value]]))), value)
self.assertEqual(unpack(unpack(join([[value, 0]]))), value)
self.assertEqual(unpack(unpack(join([[value], 0]))), value)
self.assertEqual(unpack(unpack(join([[value, 0], 0]))), value)
check('')
check('spam')
check('sp am')
check('sp\tam')
check('sp\nam')
check(' \t\n')
check('{spam}')
check('{sp am}')
check('"spam"')
check('"sp am"')
check('{"spam"}')
check('"{spam}"')
check('sp\\am')
check('"sp\\am"')
check('"{}" "{}"')
check('"\\')
check('"{')
check('"}')
check('\n\\')
check('\n{')
check('\n}')
check('\\\n')
check('{\n')
check('}\n')
示例3: _format_optvalue
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import _join [as 别名]
def _format_optvalue(value, script=False):
"""Internal function."""
if script:
# if caller passes a Tcl script to tk.call, all the values need to
# be grouped into words (arguments to a command in Tcl dialect)
value = _stringify(value)
elif isinstance(value, (list, tuple)):
value = _join(value)
return value
示例4: _format_elemcreate
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import _join [as 别名]
def _format_elemcreate(etype, script=False, *args, **kw):
"""Formats args and kw according to the given element factory etype."""
spec = None
opts = ()
if etype in ("image", "vsapi"):
if etype == "image": # define an element based on an image
# first arg should be the default image name
iname = args[0]
# next args, if any, are statespec/value pairs which is almost
# a mapdict, but we just need the value
imagespec = _join(_mapdict_values(args[1:]))
spec = "%s %s" % (iname, imagespec)
else:
# define an element whose visual appearance is drawn using the
# Microsoft Visual Styles API which is responsible for the
# themed styles on Windows XP and Vista.
# Availability: Tk 8.6, Windows XP and Vista.
class_name, part_id = args[:2]
statemap = _join(_mapdict_values(args[2:]))
spec = "%s %s %s" % (class_name, part_id, statemap)
opts = _format_optdict(kw, script)
elif etype == "from": # clone an element
# it expects a themename and optionally an element to clone from,
# otherwise it will clone {} (empty element)
spec = args[0] # theme name
if len(args) > 1: # elementfrom specified
opts = (_format_optvalue(args[1], script),)
if script:
spec = '{%s}' % spec
opts = ' '.join(opts)
return spec, opts
示例5: colorlist
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import _join [as 别名]
def colorlist(self, *args):
if tkinter.TkVersion >= 8.6 and self.wantobjects:
return args
else:
return tkinter._join(args)