Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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()
    pages.append_page(textview, Gtk.Label("New Page"))

The code that calls that is:

def on_btn_new_page_activate(self, widget):

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


EDIT: Now the following error occurs:

Traceback (most recent call last):
File "/home/nja/notetaker/notetaker/", line 100, in on_btn_new_page_activate
File "/home/nja/notetaker/notetaker/", line 73, in get_pages
pages = self.subject.get_nth_page(subjectNum)
AttributeError: 'NotetakerWindow' object has no attribute 'subject'
share|improve this question
@Nick - It has also been quoted from the FAQ a billion times: "We welcome questions about: Development on Ubuntu." – RobotHumans Jun 23 '12 at 12:30
up vote 4 down vote accepted

The fix is:

not self.add_page(self.get_pages)

the latter passes in the function self.get_pages not its return value


from: pages = self.subject.get_nth_page(subjectNum)

to: pages = self.subjects.get_nth_page(subjectNum)

This is a simple typo we all make from time to time.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.