gpt4 book ai didi

python - pyforms 无法从 pysettings 导入conf

转载 作者:行者123 更新时间:2023-12-01 03:28:26 28 4
gpt4 key购买 nike

这是我的 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__ = "ricardojvr@gmail.com"
__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

最佳答案

关于python - pyforms 无法从 pysettings 导入conf,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41216740/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com