Re: Merging instance with GtkBuilder object
- From: Simon van der Linden <svdlinden gnome org>
- To: Paul Lange <palango gmx de>
- Cc: python-hackers-list gnome org
- Subject: Re: Merging instance with GtkBuilder object
- Date: Tue, 28 Feb 2012 21:14:57 +0100
Hey Paul,
On 28/02/12 04:59, Paul Lange wrote:
This is my code:
from gi.repository import Gtk
class Test(Gtk.Window):
def __init__(self):
builder = Gtk.Builder()
builder.add_from_file("ui.glade")
self = builder.get_object("window1")
self.connect("delete-event", Gtk.main_quit)
self.msg = builder.get_object("label1")
# attribute not found exception
self.set_test()
self.show_all()
Obviously, you can change the reference 'self', but that will not
change the instance being initialized (i.e. it will not make 'window1'
an instance of 'Test'). I barely used 'GtkBuilder', but the class
attribute of the object tag suggests that you could replace 'GtkWindow'
by 'Test'. I know neither if that would actually work with a class
exterior to GTK nor how that would interact with a subclass written in
Python, though...
-- Simon
[
Date Prev][Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]