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
def on_btn_new_subject_activate(self, widget):
    self.subjects.append_page(Gtk.TextView(), "Testing")

I am trying to create a new tab on a text area but I whenever the signal is called by the event (I click the button), this happens:

TypeError: Expected Gtk.Widget, but got GObjectMeta

I have also tried variations on this like "Gtk.GtkTextView()" and "GtkTextView()" with no success

What am I supposed to be using to get a text area in that tab?

share|improve this question
up vote 1 down vote accepted

I think you must initialize Gtk.TextView() before use.... I was also facing same problem 2 days before.... Just check following code

        self.textview = Gtk.TextView()
        self.textbuffer = self.textview.get_buffer()
        self.textbuffer.set_text("This is some text inside of a Gtk.TextView. "
            + "Select text and click one of the buttons 'bold', 'italic', "
            + "or 'underline' to modify the text accordingly.")


share|improve this answer
I'm not getting the error, but it is not adding a page to the Notebook. – njallam Jun 22 '12 at 15:46
What is widget type of subject? – gau1991 Jun 22 '12 at 15:55
subjects is a Notebook widget – njallam Jun 22 '12 at 16:02
It is now called pages, but it is still the same thing. – njallam Jun 22 '12 at 16:12
This is my structure:… – njallam Jun 22 '12 at 16:37

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.