UmSenhorQualquer/pyforms

ImportError: cannot import name BaseWidget

Closed this issue · 2 comments

Cant import BaseWidget

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')

    #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.start_app( SimpleExample1 )

May be you had version v4 installed.
You should use: from pyforms.basewidget import BaseWidget

Got this issue while approaching the lib using official documentation: https://pyforms.readthedocs.io/en/v3.0/getting-started/the-basic/
It seems there's no v4.0 version on readthedocs