在创建用于 enaml 的 python class 时传递 Atom 的目的是什么?

What purpose does passing Atom do when creating a python class for use with enaml?

我正在尝试使用 Enaml 编写我的第一个 GUI,但在他们创建 class 时我无法弄清楚对 Atom 的引用。我知道它是一个 IDE(我正在使用 PyCharm),但我不确定它是否引用了它。我在网上似乎找不到任何有用的文档。你能在 their documentation 的这个示例代码中向我解释一下吗?我将其格式化如下:

class Person(Atom):
    """ A simple class representing a person object.

    """
    last_name = Unicode()

    first_name = Unicode()

    age = Range(low=0)

    debug = Bool(False)

    @observe('age')
    def debug_print(self, change):
        """ Prints out a debug message whenever the person's age changes.

        """
        if self.debug:
            templ = "{first} {last} is {age} years old."
            s = templ.format(
                first=self.first_name, last=self.last_name, age=self.age,
            )
            print(s)

我想我应该提到这不是链接文档中提供的完整文件!

编辑:我在他们的 github 上遗漏了一些有用的东西,在那里我找到了更多但仍然缺乏的文档。

atom 是一个在其上构建 enaml 的库(不是流行的编辑器)。它基本上提供低内存占用 Python 对象并实现观察者模式,允许在属性值更改时得到通知。 安装 enaml pip 时应该自动拉原子。 Atom 目前缺少文档,但示例中涵盖了基础知识 (https://github.com/nucleic/atom)。

最佳

马修