import gi gi.require_version("Gtk", "3.0") from gi.repository import Gtk class MyWindow(Gtk.Window): def __init__(self): super().__init__(title="Hello GNOME") # Create a button widget self.button = Gtk.Button(label="Click Here") self.button.connect("clicked", self.on_button_clicked) # Add the button to the window self.add(self.button) def on_button_clicked(self, widget): # Display a dialog when the button is clicked dialog = Gtk.MessageDialog( transient_for=self, flags=0, message_type=Gtk.MessageType.INFO, buttons=Gtk.ButtonsType.OK, text="Hello, this is a dialog!", ) dialog.format_secondary_text( "This is an example of using a button with GTK in Python." ) dialog.run() dialog.destroy() # Create and run the application win = MyWindow() win.connect("destroy", Gtk.main_quit) win.show_all() Gtk.main() https://github.com/MominIqbal-1234