xeon zolt
xeon zolt

Reputation: 195

how to align notebook bar on left side in pygtk?

i am having problem in aligning the notebook bar on left side its default on top in pygtk

# starting with notebook  from here
        self.notebook = Gtk.Notebook()
        self.add(self.notebook)
        self.page1 = Gtk.Box()
        self.page1.set_border_width(10)
        self.notebook.append_page(self.page1, Gtk.Label('page 1'))
        self.page1.add(Gtk.Label('Nvidia'))

        self.page2 = Gtk.Box()
        self.page2.set_border_width(10)
        self.page2.add(Gtk.Label('A page with an image for a Title.'))
        #self.notebook.append_page(self.page2,Gtk.Image.new_from_icon_name("wifi",Gtk.IconSize.MENU))
        self.notebook.append_page(self.page2,Gtk.Label('Wifi'))

and how can i have a icon and a lable both on a notebook page head

Upvotes: 1

Views: 531

Answers (1)

elya5
elya5

Reputation: 2258

Here is an example solving both problems:

#!/usr/bin/env python3
from gi.repository import Gtk


class Window(Gtk.Window):
    def __init__(self):
        super().__init__()
        self.connect('delete-event', Gtk.main_quit)

        content = Gtk.Label(label='Page content')

        label_box = Gtk.HBox()
        label_box.pack_start(
            Gtk.Image.new_from_icon_name('text-x-generic', 1),
            False, False, 5)
        label_box.pack_start(Gtk.Label(label='Page 1'), True, True, 0)
        label_box.show_all()

        notebook = Gtk.Notebook()
        notebook.append_page(content, label_box)
        notebook.set_tab_pos(Gtk.PositionType.LEFT)

        self.add(notebook)
        self.show_all()


if __name__ == '__main__':
    Window()
    Gtk.main()

Upvotes: 1

Related Questions