from gi.repository import Gtk, GObject

class MyButton(Gtk.Button):
    __gtype_name__ = 'MyButton'

    def __init__(self):
        Gtk.Button.__init__(self)

GObject.type_register(MyButton)

b = GObject.new(MyButton)
print b
assert b.__gtype_name__ == 'MyButton'
assert b.__grefcount__ == 1
