Pmw.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:ecel 作者: ARL-UTEP-OC 项目源码 文件源码
def cget(self, option):
        # Get current configuration setting.

        # Return the value of an option, for example myWidget['font']. 

        if self._optionInfo.has_key(option):
            return self._optionInfo[option][_OPT_VALUE]
        else:
            index = string.find(option, '_')
            if index >= 0:
                component = option[:index]
                componentOption = option[(index + 1):]

                # Expand component alias
                if self.__componentAliases.has_key(component):
                    component, subComponent = self.__componentAliases[component]
                    if subComponent is not None:
                        componentOption = subComponent + '_' + componentOption

                    # Expand option string to write on error
                    option = component + '_' + componentOption

                if self.__componentInfo.has_key(component):
                    # Call cget on the component.
                    componentCget = self.__componentInfo[component][3]
                    return componentCget(componentOption)
                else:
                    # If this is a group name, call cget for one of
                    # the components in the group.
                    for info in self.__componentInfo.values():
                        if info[4] == component:
                            componentCget = info[3]
                            return componentCget(componentOption)

        raise KeyError, 'Unknown option "' + option + \
                '" for ' + self.__class__.__name__
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号