當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。