#!/usr/bin/python3
from gi.repository import Gtk
import gettext
_ = gettext.gettext

class TopWindow(Gtk.Window):

    def __init__(self):
        gettext.textdomain('debhello')
        Gtk.Window.__init__(self)
        self.title = _("Hello World!")
        self.counter = 0
        self.border_width = 10
        self.set_default_size(400, 100)
        self.set_position(Gtk.WindowPosition.CENTER)
        self.button = Gtk.Button(label=_("Click me!"))
        self.button.connect("clicked", self.on_button_clicked)
        self.add(self.button)
        self.connect("delete-event", self.on_window_destroy)

    def on_window_destroy(self, *args):
        Gtk.main_quit(*args)

    def on_button_clicked(self, widget):
        self.counter += 1
        widget.set_label(_("Hello, World!\nClick count = %i") % self.counter)

def main():
    window = TopWindow()
    window.show_all()
    Gtk.main()

if __name__ == '__main__':
    main()

