GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Sun Aug 28, 2016 12:06 pm

All times are UTC

Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Pango Error From gtk_widget_show and gtk_widget_show_all
PostPosted: Wed Jan 25, 2006 3:49 pm 

Joined: Wed Jan 25, 2006 3:10 pm
Posts: 1
Location: Blacksburg, VA
I am an experienced programmer but am new to GTK+. I have been trying to work through the GTK+ 2.0 Tutorial. The project builds and runs so long as it does not call gtk_widget_show() on the button widget. If gtk_widget_show() is called the following error appears:
Pango-ERROR **: file shape.c line 75 (pango_shape): assertion failed: (glyphs->num_glyphs > 0)

I am guessing that I have made some mistake that is obvious to someone familiar with GTK+ but I really do not see the problem. The code for my project is below (the gtk_widget_show(button) call is the problem line)
#include <gtk/gtk.h>

static void destroy( GtkWidget *widget,
                     gpointer   data )
    gtk_main_quit ();

int main( int   argc,
          char *argv[] )
    GtkWidget *window;
    GtkWidget *button;

    /* This is called in all GTK applications. Arguments are parsed
     * from the command line and are returned to the application. */
    gtk_init (&argc, &argv);

    /* create a new window */
    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

    /* Here we connect the "destroy" event to a signal handler.
     * This event occurs when we call gtk_widget_destroy() on the window,
     * or if we return FALSE in the "delete_event" callback. */
    g_signal_connect (G_OBJECT (window), "destroy",
            G_CALLBACK (destroy), NULL);

    /* Sets the border width of the window. */
    gtk_container_set_border_width (GTK_CONTAINER (window), 10);

    /* Creates a new button with the label "Hello World". */
    button = gtk_button_new_with_label ("Hello World");

    /* This packs the button into the window (a gtk container). */
    gtk_container_add (GTK_CONTAINER (window), button);

    /* The final step is to display this newly created widget. */
    gtk_widget_show (button);

    /* and the window */
    gtk_widget_show (window);

    /* All GTK applications must have a gtk_main(). Control ends here
     * and waits for an event to occur (like a key press or
     * mouse event). */
    gtk_main ();

    return 0;

So, what am I doing wrong :?:

I had thought that the tutorial might simply be out of date but I have the same problem with the gtk_widget_show_all() in the code outlined in
the GTK+ Basics Chapter of GTK+/Gnome Application Development

In case it matters I am using the following libraries:
  • atk 1.10.3
  • cairo 1.0.2
  • glib 2.8.5
  • gtk+ 2.8.9
  • gettext 0.14.5
  • libiconv 1.9.1
  • libpng-config 0.20
  • pango 1.10.2
  • zlib 123

These were the most recent versions listed in the win32 directory at

 Post subject:
PostPosted: Thu Mar 09, 2006 7:10 pm 
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 12:07 am
Posts: 563
Location: Portland, OR USA
It compiles and runs fine for me using what you posted and gtk_widget_show_all on the window. I used the following to compile it:
gcc -o test -Wall -g main.c `pkg-config gtk+-2.0 --cflags --libs`

However, I'm using GTK+ 2.6.10 still.

- Micah

Micah Carrick - Forum Administrator

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group