DEV Community

Juanjo Salvador
Juanjo Salvador

Posted on

6 3

Today I learned: building an application's GUI using Glade

I've wrote a lot of Python's scripts for many task, such like web scraping or Telegram cool things. But until this week I never designed a non-web-based UI. I started using Glade and Gtk.

Just drag and drop some widgets into a GtkApplicationWindow, save it into your project's folder and load it.

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

    from gi.repository import Gtk

    class ButtonHander():
        # button action's code here!

    builder = Gtk.Builder()
    builder.add_from_file("gui.glade")
    builder.connect_signals(ButtonHandler())

    window = builder.get_object("mainWindow")
    window.show_all()

    Gtk.main()
Enter fullscreen mode Exit fullscreen mode

Because GUIs are cool!

Top comments (2)

Collapse
 
ikemkrueger profile image
Ikem Krueger • Edited

I use glade for my gui tools all the time. It‘s a real time saver. :)

Collapse
 
themainframech profile image
The Mainframe

Thanks for sharing! Glade looks pretty similar to page.sourceforge.net/ which is for Python.

Best practices for optimal infrastructure performance with Magento

Running a Magento store? Struggling with performance bottlenecks? Join us and get actionable insights and real-world strategies to keep your store fast and reliable.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️