Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.
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
add comment

1 Answer

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.")
        mywindows.add(self.textview)

Refer: http://python-gtk-3-tutorial.readthedocs.org/en/latest/textview.html

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: askubuntu.com/questions/154687/… –  njallam Jun 22 '12 at 16:37
show 3 more comments

Your Answer

 
discard

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.