I am a beginner to using Glade and PyGTK and I am trying to create a window with a custom title bar that is created using the header bar component and the rest of the UI being done through a GLADE file. However instead of getting one window I am getting two different windows, one containing the header bar and the other containing the UI components developed in Glade. Could someone point me as to how to make them appear in the same window. PFB the code that has been written so far :
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, Gio
class HeaderBarWindow(Gtk.Window):
def __init__(self):
Gtk.Window.__init__(self, title="MLPP")
self.set_border_width(10)
self.set_default_size(400, 200)
hb = Gtk.HeaderBar()
hb.set_show_close_button(True)
hb.props.title = "MLPP"
self.set_titlebar(hb)
titleBarImage = Gtk.Image()
titleBarImage.set_from_file('TitleIcon.png')
hb.pack_start(titleBarImage);
gladefile = "MLPP.glade"
builder = Gtk.Builder()
builder.add_from_file(gladefile)
self.add(builder.get_object("window1"))
win = HeaderBarWindow()
win.connect("delete-event", Gtk.main_quit)
win.show_all()
Gtk.main()