Your Glade file does not declare any GtkTextBuffer (so you need to add a text buffer in your Glade file and set the 'buffer' property of that view to refer to that buffer)... so view.get_buffer() returns NULL. A suggestion: Don't keep your GtkBuilder object alive for your program lifetime, just create it in your constructor, save and *check* all the objects you might need at construction time and then refer to those objects as instance members throughout your object's lifetime. Doing this way will help you in a few ways: a.) Your code will be more readable, you will be able to always trust that self.buffer exists b.) Checking and assigning self.buffer at initialization time will help you catch any errors when you modify your Glade file early (i.e. when assigning them, if you've mis-named anything after changing a Glade file, simply starting your program once will tell you for sure that your object has everything in place). c.) You avoid keeping around the extra memory reserved for a GtkBuilder object, which is just unneeded, since you already built the UI. Cheers, -Tristan On Thu, Dec 13, 2012 at 10:36 AM, Kevin Hunter <hunteke@xxxxxxxxx> wrote: > Hello GTK+ list, > > I am a newbie to GTK development so apologies if I've overlooked something > large. I'm trying to build a simple GUI from a glade file. However, > whenever I try to set the text of a GtkTextView object, I get a segmentation > fault. Here's my basic workflow: > > --- > #!/usr/bin/env python3 > > from gi.repository import Gtk > > class Handler: > def __init__ ( self, builder ): > self.builder = builder > > destroy = Gtk.main_quit > > def on_button_clicked ( self, button ): > buf = self.builder.get_object('TextViewInPane').get_buffer() > buf.set_text("Hello, World!") # this appears to work. However > > # ... after returning from this callback function, Gtk core > # dumps. :-( why? > > def main ( ): > builder = Gtk.Builder() > builder.add_from_file('gui.glade') > builder.connect_signals( Handler( builder ) ) > builder.get_object('MainWindow').show_all() > > return Gtk.main() > > main() > --- > > In the case that I may have messed up my Glade file, I've attached it in the > Zip archive. > > Any pointers for a newbie? > > Many thanks, > > Kevin > > _______________________________________________ > gtk-list mailing list > gtk-list@xxxxxxxxx > https://mail.gnome.org/mailman/listinfo/gtk-list > _______________________________________________ gtk-list mailing list gtk-list@xxxxxxxxx https://mail.gnome.org/mailman/listinfo/gtk-list