Pyforms AttributeError: ‘module’ object has no attribute ‘start_app’

Pyforms AttributeError: ‘module’ object has no attribute ‘start_app’

在我的 Raspberry Pi 3 上安装 pyforms 后,我尝试了 运行 我在 readthedocs 上找到的示例,但是应用程序抛出 AttributeError(我都尝试了 python2 和 python3)


Python代码

import pyforms
from   pyforms          import BaseWidget
from   pyforms.Controls import ControlText
from   pyforms.Controls import ControlButton

class SimpleExample1(BaseWidget):

    def __init__(self):
        super(SimpleExample1,self).__init__('Simple example 1')

        #Definition of the forms fields
        self._firstname     = ControlText('First name', 'Default value')
        self._middlename    = ControlText('Middle name')
        self._lastname      = ControlText('Lastname name')
        self._fullname      = ControlText('Full name')
        self._button        = ControlButton('Press this button')


#Execute the application
if __name__ == "__main__":   pyforms.start_app( SimpleExample1 )

错误:

Traceback (most recent call last):
  File "PiControl.py", line 20, in <module>
    if __name__ == "__main__":   pyforms.start_app( SimpleExample1 )
AttributeError: ‘module’ object has no attribute ‘start_app’


编辑:

我尝试使用

手动导入 start_app
from pyforms.gui.standaloneManager import start_app

但后来我得到另一个 ImportError:

Traceback (most recent call last):
  File "PiControl.py", line 4, in <module>
    from   pyforms.gui.standaloneManager import start_app
ImportError: cannot import name 'start_app'

这是非常奇怪的行为,可能意味着您的安装已损坏。尝试从存储库安装最新版本:

pip install -U git+https://github.com/UmSenhorQualquer/pyforms.git 
pip install -U git+https://github.com/UmSenhorQualquer/pysettings.git
pip install -U git+https://bitbucket.org/fchampalimaud/logging-bootstrap.git