从 WIX 表单访问属性

Acess Attributes from WX Forms

给定以下代码Gist

我正在尝试使用我的 parent class 中的属性,但那时我无法访问。

    src = BluTools.sourceFile.GetValue()
    dest = BluTools.destFile.GetValue()
    codigo_empresa = BluTools.codigo_empresa.GetValue()
    codigo_deposito = BluTools.codigo_deposito.GetValue()
    data = BluTools.data_inicio.GetValue()

但是give-me错误:

    AttributeError: 'BluTools' object has no attribute 'sourceFile'

您需要阅读 classes 在 Python 中的工作原理。您通常不会通过直接调用 class 来访问属性。您需要创建 class:

的实例
blue = BluTools()
blue.some_attr()

或者在您的情况下,使用 self 而不是 BluTools

src = self.sourceFile.GetValue()
dest = self.destFile.GetValue()
codigo_empresa = self.codigo_empresa.GetValue()
codigo_deposito = self.codigo_deposito.GetValue()
data = self.data_inicio.GetValue()