Python GUI Development with GTK+ 3 - Tutorial 9 - Notebook Tabbed Layout

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

Do you have any examples where you have a top row of tabs and each tab would have a sub set of tabs on the left side?
Thank you

andrelabbe
Автор

Here's the updated code with the new stuff they changed in pygobject til now:

import gi
gi.require_version("Gtk", "3.0")

from gi.repository import Gtk


class MainWindow(Gtk.Window):

def __init__(self):
Gtk.Window.__init__(self, title="Notebook Demo")
self.set_border_width(10)
self.notebook = Gtk.Notebook()
self.add(self.notebook)

# First page
self.page1 = Gtk.Box()

is the stuff that is in the main area.'))
self.notebook.append_page(child=self.page1, Tab'))

# Second page
self.page2 = Gtk.Box()

there durr durr I am page two.'))
icon = Gtk.Image.new_from_icon_name(icon_name="gnome-dev-cdrom-audio", size=Gtk.IconSize.MENU)
self.notebook.append_page(child=self.page2, tab_label=icon)


window = MainWindow()
window.connect("delete-event", Gtk.main_quit)
window.show_all()
Gtk.main()

rumplstiltztinkerstein
Автор

I was able to select custom image by entering full path of the image but Its impossible to size it as new image from file only takes one parameter not the size :(

coldblaze