Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7418509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:54:02+00:00 2026-05-29T07:54:02+00:00

I am trying to create a really simple GUI using GtkBuilder and glade. To

  • 0

I am trying to create a really simple GUI using GtkBuilder and glade. To achive this I follow the official Gtk+ 3 Reference manual’s tutorial. The only difference to the original code is, that I do not connect to the widget’s signals for simplicity (and therefore removed their callback function too):

#include <gtk/gtk.h>

int
main (int   argc,
      char *argv[])
{
  GtkBuilder *builder;
  GObject *window;
  GObject *button;

  gtk_init (&argc, &argv);

  /* Construct a GtkBuilder instance and load our UI description */
  builder = gtk_builder_new ();
  gtk_builder_add_from_file (builder, "builder.ui", NULL);


  gtk_main ();

  return 0;
}

The “builder.ui” file used in the tutorial looks like this:

        <interface>
  <object id="window" class="GtkWindow">
    <property name="visible">True</property>
    <property name="title">Grid</property>
    <property name="border-width">10</property>
    <child>
      <object id="grid" class="GtkGrid">
        <property name="visible">True</property>
        <child>
          <object id="button1" class="GtkButton">
            <property name="visible">True</property>
            <property name="label">Button 1</property>
          </object>
          <packing>
            <property name="left-attach">0</property>
            <property name="top-attach">0</property>
          </packing>
        </child>
        <child>
          <object id="button2" class="GtkButton">
            <property name="visible">True</property>
            <property name="label">Button 2</property>
          </object>
          <packing>
            <property name="left-attach">1</property>
            <property name="top-attach">0</property>
          </packing>
        </child>
        <child>
          <object id="quit" class="GtkButton">
            <property name="visible">True</property>
            <property name="label">Quit</property>
          </object>
          <packing>
            <property name="left-attach">0</property>
            <property name="top-attach">1</property>
            <property name="width">2</property>
          </packing>
        </child>
      </object>
      <packing>
      </packing>
    </child>
  </object>
</interface>

… and causes no problems at all. The program compiles and produces the desired window. However, when I try to use my own .ui file (generated by glade 3.10.0) I don’t get any result at all. The Application enters the mainloop and no window appears. The GUI file I am using is:

<?xml version="1.0" encoding="UTF-8"?>
<interface>
  <!-- interface-requires gtk+ 3.0 -->
  <object class="GtkWindow" id="Window">
    <property name="can_focus">False</property>
    <property name="border_width">15</property>
    <child>
      <object class="GtkLabel" id="fooLabel">
        <property name="visible">True</property>
        <property name="can_focus">False</property>
        <property name="label" translatable="yes">foobar</property>
      </object>
    </child>
  </object>
</interface>

What am I doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T07:54:03+00:00Added an answer on May 29, 2026 at 7:54 am

    You’re only reading the xml file, you’ll need some code that manipulates the UI stuff , e.g. show the top level window in your .ui :

    int main (int   argc, char *argv[])
    {
      GtkBuilder      *builder; 
      GtkWidget       *window;
    
      gtk_init (&argc, &argv);
    
      builder = gtk_builder_new ();
      gtk_builder_add_from_file (builder, "tutorial.xml", NULL);
      window = GTK_WIDGET (gtk_builder_get_object (builder, "Window"));
      g_object_unref (G_OBJECT (builder));
      gtk_widget_show (window);                
      gtk_main ();
    
      return 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a really simple to do list using an array and
This may be a really simple question, but I'm trying to create the database
this one is really easy. I'm trying to create a Regular Expression that will
A little background: I'm using Spring and Hibernate to create a really simple domain/dao/service
I have a really simple stored procedure that looks like this: CREATE PROCEDURE _Visitor_GetVisitorIDByVisitorGUID
I'm trying to create a GUI in Python using the Tkinter module, and part
I'm trying to write a really simple prototype of a CMS system using ASP.Net
I'm trying to create a simple media player interface using WPF. Though I'm a
I almost guarantee this is something simple. I am trying to create a generic
I'm trying to create a really simple animation that moves along an absolutely positioned

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.