GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Sat Jun 25, 2016 1:35 am

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Gtk Drawing
PostPosted: Tue Jan 05, 2016 1:26 pm 
Offline
Familiar Face

Joined: Thu Jul 02, 2015 7:30 am
Posts: 18
Hi,

i write program for drawing but i got error.here i attach error list and coding please help me,

Thank You

/*gcc -Wall font_size1.c -o font_size1 `pkg-config --cflags --libs gtk+-3.0`*/
#include<gtk/gtk.h>
#include<cairo.h>

static gboolean draw_cb(GtkWidget *widget,cairo_t *cr,gpointer data)
{
cairo_set_source_rgb(cr,1,1,1);
cairo_paint(cr);

cairo_set_source_rgb(cr,0.42,0.65,0.85);
cairo_set_line_width(cr,6);
cairo_rectangle(cr,3,3,100,100);
cairo_stroke(cr);

cairo_set_source_rgb(cr,0.17,0.63,0.12);
cairo_set_line_width(cr,2);
cairo_arc(cr,0,0,50,0,2*3.14);

cairo_set_source_rgb(cr,0.77,0.16,0.13);
cairo_set_line_width(cr,6);
cairo_move_to(cr,80,160);
cairo_line_to(cr,200,160);
cairo_stroke(cr);

return FALSE;
}

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

window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
g_signal_connect(window,"destroy",G_CALLBACK(gtk_main_quit),NULL);

da=gtk_drawing_area_new();
gtk_widget_set_size_request(da,300,300);
g_signal_connect(da,"draw",G_CALLBACK(draw_cb),NULL);

gtk_container_add(GTK_CONTAINER(window),da);
gtk_widget_show(da);
gtk_widget_show(window);
gtk_main();
return 0;
}

and this is my error list

(process:3578): Gtk-CRITICAL **: _gtk_style_cascade_get_for_screen: assertion 'GDK_IS_SCREEN (screen)' failed

(process:3578): Gtk-CRITICAL **: _gtk_style_provider_private_lookup: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_lookup_resolve: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_rgba_value_get_rgba: assertion 'rgba->class == &GTK_CSS_VALUE_RGBA' failed

(process:3578): Gtk-CRITICAL **: _gtk_style_provider_private_lookup: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_lookup_resolve: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_rgba_value_get_rgba: assertion 'rgba->class == &GTK_CSS_VALUE_RGBA' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_rgba_value_get_rgba: assertion 'rgba->class == &GTK_CSS_VALUE_RGBA' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_rgba_value_get_rgba: assertion 'rgba->class == &GTK_CSS_VALUE_RGBA' failed

(process:3578): Gtk-CRITICAL **: _gtk_style_provider_private_lookup: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_lookup_resolve: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_rgba_value_get_rgba: assertion 'rgba->class == &GTK_CSS_VALUE_RGBA' failed

(process:3578): Gtk-CRITICAL **: _gtk_style_provider_private_lookup: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_lookup_resolve: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_rgba_value_get_rgba: assertion 'rgba->class == &GTK_CSS_VALUE_RGBA' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_rgba_value_get_rgba: assertion 'rgba->class == &GTK_CSS_VALUE_RGBA' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_rgba_value_get_rgba: assertion 'rgba->class == &GTK_CSS_VALUE_RGBA' failed

(process:3578): Gtk-CRITICAL **: _gtk_style_provider_private_lookup: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_lookup_resolve: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_rgba_value_get_rgba: assertion 'rgba->class == &GTK_CSS_VALUE_RGBA' failed

(process:3578): Gtk-CRITICAL **: _gtk_style_provider_private_lookup: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_lookup_resolve: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_rgba_value_get_rgba: assertion 'rgba->class == &GTK_CSS_VALUE_RGBA' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_rgba_value_get_rgba: assertion 'rgba->class == &GTK_CSS_VALUE_RGBA' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_rgba_value_get_rgba: assertion 'rgba->class == &GTK_CSS_VALUE_RGBA' failed

(process:3578): Gtk-CRITICAL **: _gtk_style_provider_private_lookup: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_lookup_resolve: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_rgba_value_get_rgba: assertion 'rgba->class == &GTK_CSS_VALUE_RGBA' failed

(process:3578): Gtk-CRITICAL **: _gtk_style_provider_private_lookup: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_lookup_resolve: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_rgba_value_get_rgba: assertion 'rgba->class == &GTK_CSS_VALUE_RGBA' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_rgba_value_get_rgba: assertion 'rgba->class == &GTK_CSS_VALUE_RGBA' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_rgba_value_get_rgba: assertion 'rgba->class == &GTK_CSS_VALUE_RGBA' failed

(process:3578): Gtk-CRITICAL **: _gtk_style_provider_private_lookup: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_lookup_resolve: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_rgba_value_get_rgba: assertion 'rgba->class == &GTK_CSS_VALUE_RGBA' failed

(process:3578): Gtk-CRITICAL **: _gtk_style_provider_private_lookup: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_lookup_resolve: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_rgba_value_get_rgba: assertion 'rgba->class == &GTK_CSS_VALUE_RGBA' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_rgba_value_get_rgba: assertion 'rgba->class == &GTK_CSS_VALUE_RGBA' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_rgba_value_get_rgba: assertion 'rgba->class == &GTK_CSS_VALUE_RGBA' failed

(process:3578): Gtk-CRITICAL **: _gtk_style_provider_private_lookup: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_lookup_resolve: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_rgba_value_get_rgba: assertion 'rgba->class == &GTK_CSS_VALUE_RGBA' failed

(process:3578): Gtk-CRITICAL **: _gtk_style_provider_private_lookup: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_lookup_resolve: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_rgba_value_get_rgba: assertion 'rgba->class == &GTK_CSS_VALUE_RGBA' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_rgba_value_get_rgba: assertion 'rgba->class == &GTK_CSS_VALUE_RGBA' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_rgba_value_get_rgba: assertion 'rgba->class == &GTK_CSS_VALUE_RGBA' failed

(process:3578): Gtk-CRITICAL **: _gtk_style_provider_private_lookup: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_lookup_resolve: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_rgba_value_get_rgba: assertion 'rgba->class == &GTK_CSS_VALUE_RGBA' failed

(process:3578): Gtk-CRITICAL **: _gtk_style_provider_private_lookup: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_lookup_resolve: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_rgba_value_get_rgba: assertion 'rgba->class == &GTK_CSS_VALUE_RGBA' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_rgba_value_get_rgba: assertion 'rgba->class == &GTK_CSS_VALUE_RGBA' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_rgba_value_get_rgba: assertion 'rgba->class == &GTK_CSS_VALUE_RGBA' failed

(process:3578): Gtk-CRITICAL **: _gtk_style_provider_private_lookup: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_lookup_resolve: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_rgba_value_get_rgba: assertion 'rgba->class == &GTK_CSS_VALUE_RGBA' failed

(process:3578): Gtk-CRITICAL **: _gtk_style_provider_private_lookup: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_lookup_resolve: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_rgba_value_get_rgba: assertion 'rgba->class == &GTK_CSS_VALUE_RGBA' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_rgba_value_get_rgba: assertion 'rgba->class == &GTK_CSS_VALUE_RGBA' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_rgba_value_get_rgba: assertion 'rgba->class == &GTK_CSS_VALUE_RGBA' failed

(process:3578): Gtk-CRITICAL **: _gtk_style_provider_private_lookup: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_lookup_resolve: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_rgba_value_get_rgba: assertion 'rgba->class == &GTK_CSS_VALUE_RGBA' failed

(process:3578): Gtk-CRITICAL **: _gtk_style_provider_private_lookup: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_lookup_resolve: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_rgba_value_get_rgba: assertion 'rgba->class == &GTK_CSS_VALUE_RGBA' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_rgba_value_get_rgba: assertion 'rgba->class == &GTK_CSS_VALUE_RGBA' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_rgba_value_get_rgba: assertion 'rgba->class == &GTK_CSS_VALUE_RGBA' failed

(process:3578): Gtk-CRITICAL **: _gtk_style_provider_private_lookup: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_lookup_resolve: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_rgba_value_get_rgba: assertion 'rgba->class == &GTK_CSS_VALUE_RGBA' failed

(process:3578): Gtk-CRITICAL **: _gtk_style_provider_private_lookup: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_lookup_resolve: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_rgba_value_get_rgba: assertion 'rgba->class == &GTK_CSS_VALUE_RGBA' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_rgba_value_get_rgba: assertion 'rgba->class == &GTK_CSS_VALUE_RGBA' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_rgba_value_get_rgba: assertion 'rgba->class == &GTK_CSS_VALUE_RGBA' failed

(process:3578): Gtk-CRITICAL **: gtk_settings_get_for_screen: assertion 'GDK_IS_SCREEN (screen)' failed

(process:3578): GLib-GObject-WARNING **: invalid (NULL) pointer instance

(process:3578): GLib-GObject-CRITICAL **: g_signal_connect_object: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed

(process:3578): Gtk-CRITICAL **: _gtk_style_cascade_get_for_screen: assertion 'GDK_IS_SCREEN (screen)' failed

(process:3578): Gtk-CRITICAL **: _gtk_style_provider_private_lookup: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_lookup_resolve: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_array_value_get_n_values: assertion 'value != NULL' failed

(process:3578): Gtk-WARNING **: Screen for GtkWindow not set; you must always set
a screen for a GtkWindow before using the window

(process:3578): Gdk-CRITICAL **: gdk_screen_get_width: assertion 'GDK_IS_SCREEN (screen)' failed

(process:3578): Gdk-CRITICAL **: gdk_screen_get_height: assertion 'GDK_IS_SCREEN (screen)' failed

(process:3578): Gtk-CRITICAL **: _gtk_css_number_value_get: assertion 'number != NULL' failed

(process:3578): Gdk-CRITICAL **: gdk_screen_get_system_visual: assertion 'GDK_IS_SCREEN (screen)' failed

(process:3578): Gdk-CRITICAL **: gdk_screen_get_root_window: assertion 'GDK_IS_SCREEN (screen)' failed

(process:3578): Gdk-CRITICAL **: gdk_screen_get_root_window: assertion 'GDK_IS_SCREEN (screen)' failed

(process:3578): Gdk-CRITICAL **: gdk_window_new: assertion 'GDK_IS_WINDOW (parent)' failed

(process:3578): Gtk-CRITICAL **: gtk_widget_register_window: assertion 'GDK_IS_WINDOW (window)' failed

(process:3578): Gtk-CRITICAL **: gtk_style_context_set_background: assertion 'GDK_IS_WINDOW (window)' failed

(process:3578): Gdk-CRITICAL **: gdk_screen_get_system_visual: assertion 'GDK_IS_SCREEN (screen)' failed
Segmentation fault


Top
 Profile  
 
 Post subject: Re: Gtk Drawing
PostPosted: Tue Jan 05, 2016 2:35 pm 
Offline
Never Seen the Sunlight

Joined: Mon Apr 28, 2008 5:52 am
Posts: 1027
Location: UK
Hallo,

GTK+ was not initialised.

You will need to use either :-

- gtk_init()
- GtkApplication

_________________
E.


Top
 Profile  
 
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: Google Adsense [Bot], Yahoo [Bot] and 3 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