-2

I have a problem in a simple Glade/Gtk project, I have some objects like Button, Text inputs etc. I have a basic error, gi.repository.Gtk has no attribute 'builder'. Any Ideas? Thanks in advance

Here's the error that I receive (https://i.stack.imgur.com/8RiN6.jpg)

import gi
gi.require_version('Gtk', '3.0')
import gi.repository
from gi.repository import Gtk

class Main:
    def __init__(self):
        gladeFile = Gtk.builder
        self.builder = Gtk.Builder()
        self.builder.add_from_file(gladeFile)
        self.builder.connect_signals(self)

        window = self.builder.get_object("button1")
        window.show()


if __name__ == '__main__':
    main = Main()
    Gtk.main()
Davide Zini
  • 21
  • 1
  • 3

1 Answers1

0

Looks like your gladeFile should be a string containing the path to your glade file, e.g. gladeFile = "example.glade".

D Malan
  • 10,272
  • 3
  • 25
  • 50