Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'ScrollMenu' object has no attribute 'add_form' #69

Open
jeremyperthuis opened this issue Dec 5, 2020 · 1 comment
Open
Labels
Bug Something isn't working

Comments

@jeremyperthuis
Copy link

I created 2 Widgets, scroll menus for each widget.
Python thows AttributeError when add_form() is applied.
I don't know if it's a bug or a misuse.

class mainTUI:

    def __init__(self, master):
        self.master = master
        self.master.set_title("menu example 2")
        self.widget_set_A = self.master.create_new_widget_set(10, 10)
        self.widget_set_B = self.master.create_new_widget_set(10, 10)

        # MENU 1
        self.menu1 = self.widget_set_A.add_scroll_menu('menu_1', 0, 0, row_span=7, column_span=2)
        self.menu1.add_key_command(py_cui.keys.KEY_ENTER, self.toggle_widget_2)
        self.master.apply_widget_set(self.widget_set_A)
        self.menu1.add_form("test")

        # MENU 2
        self.menu2 = self.widget_set_B.add_scroll_menu('menu_2', 0, 0, row_span=7, column_span=2)
        self.menu2.add_key_command(py_cui.keys.KEY_ENTER, self.toggle_widget_1)


    def toggle_widget_1(self):
        self.master.apply_widget_set(self.widget_set_A)

    def toggle_widget_2(self):
        self.master.apply_widget_set(self.widget_set_B)


root = py_cui.PyCUI(10, 10)
root.set_title('CUI TODO List')
s = mainTUI(root)
root.start()

Environment:

  • Debian
  • Terminal: gnome-terminal
  • Version: v3.30.2
@jeremyperthuis jeremyperthuis added the Bug Something isn't working label Dec 5, 2020
@jwlodek
Copy link
Owner

jwlodek commented Dec 5, 2020

To add an item to a ScrollMenu you should use add_item. If you want to show a form, at the moment the only way to do so is using the show_form_popup function which should be called using the root PyCUI object. Is one of these what you were trying to figure out? I don't think there is an add_form function in py_cui, or at least I don't see it in the docs or when I grep the repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants