I am having some trouble adding a page to a Notebook widget. The error I get is this:
AttributeError: 'function' object has no attribute 'append_page'
I assume this means the object pages in the following code has not been set to a Gtk.Notebook class.
def add_page(self, pages):
textview = Gtk.TextView()
textbuffer = textview.get_buffer()
textbuffer.set_text("")
pages.append_page(textview, Gtk.Label("New Page"))
The code that calls that is:
def on_btn_new_page_activate(self, widget):
self.add_page(self.get_pages)
The method get_pages() is following (Probably where the problem is):
def get_pages(self):
subjectNum = self.subjects.get_current_page()
pages = self.subject.get_nth_page(subjectNum)
return pages
The subjects variable is a valid Notebook fetched by the following:
self.subjects = self.builder.get_object("subjects")
Thanks.
EDIT: Now the following error occurs:
Traceback (most recent call last):
File "/home/nja/notetaker/notetaker/NotetakerWindow.py", line 100, in on_btn_new_page_activate
self.add_page(self.get_pages())
File "/home/nja/notetaker/notetaker/NotetakerWindow.py", line 73, in get_pages
pages = self.subject.get_nth_page(subjectNum)
AttributeError: 'NotetakerWindow' object has no attribute 'subject'