当前位置: 首页>>代码示例>>Python>>正文


Python _tkinter.Tcl_Obj方法代码示例

本文整理汇总了Python中_tkinter.Tcl_Obj方法的典型用法代码示例。如果您正苦于以下问题:Python _tkinter.Tcl_Obj方法的具体用法?Python _tkinter.Tcl_Obj怎么用?Python _tkinter.Tcl_Obj使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在_tkinter的用法示例。


在下文中一共展示了_tkinter.Tcl_Obj方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: config_cleaner

# 需要导入模块: import _tkinter [as 别名]
# 或者: from _tkinter import Tcl_Obj [as 别名]
def config_cleaner(widget):
        """ Some options don't like to be copied, so this returns a cleaned
            configuration from a widget
            We use config() instead of configure() because some items (ttk Scale) do
            not populate configure()"""
        new_config = dict()
        for key in widget.config():
            if key == "class":
                continue
            val = widget.cget(key)
            # Some keys default to "" but tkinter doesn't like to set config to this value
            # so skip them to use default value.
            if key in ("anchor", "justify", "compound") and val == "":
                continue
            val = str(val) if isinstance(val, Tcl_Obj) else val
            # Return correct command from master command dict
            val = _RECREATE_OBJECTS["commands"][val] if key == "command" and val != "" else val
            new_config[key] = val
        return new_config 
开发者ID:deepfakes,项目名称:faceswap,代码行数:21,代码来源:control_helper.py

示例2: tcl_obj_eq

# 需要导入模块: import _tkinter [as 别名]
# 或者: from _tkinter import Tcl_Obj [as 别名]
def tcl_obj_eq(actual, expected):
    if actual == expected:
        return True
    if isinstance(actual, _tkinter.Tcl_Obj):
        if isinstance(expected, str):
            return str(actual) == expected
    if isinstance(actual, tuple):
        if isinstance(expected, tuple):
            return (len(actual) == len(expected) and
                    all(tcl_obj_eq(act, exp)
                        for act, exp in zip(actual, expected)))
    return False 
开发者ID:aliyun,项目名称:oss-ftp,代码行数:14,代码来源:support.py


注:本文中的_tkinter.Tcl_Obj方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。