PyGObject

De Banane Atomic
Aller à la navigationAller à la recherche

Gtk.Window

Python.svg
from gi.repository import Gtk

class MainWindow:
    def __init__(self):
        self.window = Gtk.Window()
        self.window.show_all()
        self.window.connect("destroy", Gtk.main_quit)
        Gtk.main()
 
if __name__ == "__main__":
    window = MainWindow()

Glade

Python.svg
class MainWindow:
    def __init__(self):
        self.builder = Gtk.Builder()
        self.builder.add_from_file("chemin vers fichier GLADE")
        self.builder.connect_signals(self)

        self.window = self.builder.get_object("window")
        self.window.show_all()
        self.window.connect("destroy", Gtk.main_quit)
        Gtk.main()

# Signals from Glade
    def on_ok_clicked(self, widget):
        Gtk.main_quit()

if __name__ == "__main__":
    window = MainWindow()