这是我的python文件:
import pyforms
import pyside
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')
#Define the button action
self._button.value = self.__buttonAction
def __buttonAction(self):
"""Button action event"""
self._fullname.value = self._firstname.value +" "+ self._middlename.value + \
" "+ self._lastname.value
#Execute the application
if __name__ == "__main__":
pyforms.startApp( SimpleExample1 )
我在__init__.py
文件中出错:
Traceback (most recent call last):
File "C:\Python27\Ashish\pyforms\1.py", line 1, in <module>
import pyforms
File "C:\Python27\lib\site-packages\pyforms\__init__.py", line 4, in <module>
from pysettings import conf;
ImportError: No module named pysettings
这是我的__init__.py
:
#!/usr/bin/python
# -*- coding: utf-8 -*-
import logging
from pysettings import conf;
conf += 'pyforms.gui.settings'
__author__ = "Ricardo Ribeiro"
__credits__ = ["Ricardo Ribeiro"]
__license__ = "MIT"
__version__ = '0.1.7.3'
__maintainer__ = "Ricardo Ribeiro"
__email__ = "[email protected]"
__status__ = "Production"
logger = logging.getLogger(__name__)
if conf.PYFORMS_MODE in ['GUI', 'GUI-OPENCSP']:
from pyforms.gui import Controls
from pyforms.gui.BaseWidget import BaseWidget
if conf.PYFORMS_MODE in ['GUI-OPENCSP']:
from pyforms.gui.appmanager import startApp
else:
from pyforms.gui.standaloneManager import startApp
elif conf.PYFORMS_MODE in ['TERMINAL']:
from pyforms.terminal import Controls
from pyforms.terminal.BaseWidget import BaseWidget
from pyforms.terminal.appmanager import startApp
elif conf.PYFORMS_MODE in ['WEB']:
from pyforms_web.web import Controls
from pyforms_web.web.BaseWidget import BaseWidget
from pyforms_web.web.appmanager import startApp