class Controller: def __init__(self): self.view = View() self.TodoDB = TodoDB() def add_todo(self): content = self.view.get_todo_content() return Todo(content) # Main function def run(self): user_choice = self.view.welcome_menu() if int(user_choice) == 1: todo = self.add_todo() self.TodoDB.add(todo) elif int(user_choice) == 2: self.TodoDB.get_all_todos() else: self.view.error_message()
def __init__(self): self.view = View() self.TodoDB = TodoDB()