在我的覆盆子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’
编辑:
我试图用
from pyforms.gui.standaloneManager import start_app
但我得到另一个
start_app
: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
关于python - Pyforms AttributeError:“模块”对象没有属性“start_app”,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/45812647/