Vorweg, ich bin ziemlich neu in Python und OOP. Ich komme von PHP und habe die Grundzüge verstanden. Nun aber hänge ich bei meinem ersten eigenen Programm:
Ich habe folgendes:
pm.py
Code: Alles auswählen
#!/usr/bin/env python
# encoding: utf-8
import controller
import model
import view
if __name__ == "__main__":
App = view.PM().run()
Code: Alles auswählen
#!/usr/bin/env python
# encoding: utf-8
import npyscreen
class Dashboard(npyscreen.Form):
def afterEditing(self):
self.parentApp.setNextForm(None)
def create(self):
# These lines create the form and populate it with widgets.
# A fairly complex screen in only 8 or so lines of code - a line for each control.
self.Name = self.add(npyscreen.TitleText, name="Name")
self.File = self.add(npyscreen.TitleFilename, name = "Filename:")
# This lets the user interact with the Form.
F.edit()
class PM(npyscreen.NPSAppManaged):
def onstart(self):
# Startseite
self.addForm('MAIN', Dasboard, name="Dashboard")
# Indikatoren DB
# self.addForm('INDI', Indicators, name="Indikatoren")
Code: Alles auswählen
python3 pm.py
Traceback (most recent call last):
File "pm.py", line 12, in <module>
App = view.PM().run()
File "/usr/local/lib/python3.6/dist-packages/npyscreen/apNPSApplication.py", line 30, in run
return npyssafewrapper.wrapper(self.__remove_argument_call_main)
File "/usr/local/lib/python3.6/dist-packages/npyscreen/npyssafewrapper.py", line 41, in wrapper
wrapper_no_fork(call_function)
File "/usr/local/lib/python3.6/dist-packages/npyscreen/npyssafewrapper.py", line 97, in wrapper_no_fork
return_code = call_function(_SCREEN)
File "/usr/local/lib/python3.6/dist-packages/npyscreen/apNPSApplication.py", line 25, in __remove_argument_call_main
return self.main()
File "/usr/local/lib/python3.6/dist-packages/npyscreen/apNPSApplicationManaged.py", line 150, in main
self._LAST_NEXT_ACTIVE_FORM = self._Forms[self.NEXT_ACTIVE_FORM]
KeyError: 'MAIN'
Mal sehen. Ich danke Euch schon mal und bis bald