def __init__(self):
Надеюсь понятно изложил вопрос)
Думаю, что гдето рядом, но…
import time import threading from gi.repository import Gtk, GLib, GObject class ProgressBarWindow(Gtk.Window): def __init__(self): Gtk.Window.__init__(self, title="ProgressWin") self.set_border_width(20) self.connect("delete-event", self.del_progress, 1) vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=6) self.add(vbox) self.progressbar = Gtk.ProgressBar() vbox.pack_start(self.progressbar, True, True, 0) self.show_all() threading.Thread(target=Gtk.main).start() def del_progress(self, *args): if args[2] == 1: self.destroy() def on_activity(self, *args): self.progressbar.set_fraction(args[0]) class TopWindow(Gtk.Window): def __init__(self): Gtk.Window.__init__(self, title="TopWin") self.s = ProgressBarWindow() time.sleep(1) GLib.idle_add(self.s.on_activity, 0.20) self.connect("delete-event", self.close_main_window, 2) time.sleep(1) GLib.idle_add(self.s.on_activity, 0.40) self.set_border_width(5) time.sleep(1) GLib.idle_add(self.s.on_activity, 0.60) self.set_default_size(200, 150) time.sleep(1) GLib.idle_add(self.s.on_activity, 0.80) self.spinner = Gtk.Spinner() self.spinner.start() time.sleep(1) GLib.idle_add(self.s.on_activity, 1.00) self.add(self.spinner) self.show_all() self.s.destroy() def close_main_window(self, *args): if args[2] == 2: Gtk.main_quit() GObject.threads_init() TopWindow()