Bonjour,
J'ai deux fonction qui fonctionne séparément, mais lorsque j'en appel une des deux, je ne peux plus appeller l'autre car le programme plante?
Premiere fonction:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11 void fct_Advanced(GtkWidget *pButton, GtkWidget *pBox) { if(gtk_toggle_button_get_active(pButton)) { gtk_widget_show(pBox); } else { gtk_widget_hide(pBox); } }
Deuxième fonction:
White_Graph:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 void fct_Graphique() { guchar * pixel; int x; int nouvelle_coordonnee; int y=0; int Spectre1[500]; pixel = gdk_pixbuf_get_pixels(pxgraph); for (x=0;x<400;x++) { Spectre1[x]=rand()*300/RAND_MAX-1; } White_Graph(400,300); for(x=0;x<400;x++) { //y=Spectre[x]; nouvelle_coordonnee=(3*x)+(3*Spectre1[x]*400); pixel[nouvelle_coordonnee]=0; // Couleur R pixel[nouvelle_coordonnee+1]=0; // Couleur G pixel[nouvelle_coordonnee+2]=0; // Couleur B } gtk_image_set_from_pixbuf (graph, pxgraph); gtk_widget_show(graph); }
Voici les parties de mon main que je croix qui peuvent vous être utile:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13 void White_Graph(guint width, guint height) { guint n_coord; guchar * pixel; pixel= gdk_pixbuf_get_pixels(pxgraph); for(n_coord=0; n_coord<width*3*height; n_coord++) { pixel[n_coord]= 255; } gtk_image_set_from_pixbuf (graph, pxgraph); gtk_widget_show(graph); }
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 pCadre2=gtk_frame_new("Setting"); gtk_box_pack_start(GTK_BOX(pleftVBox), pCadre2, FALSE, FALSE, 0); g_signal_connect(G_OBJECT(ptemporaire1), "clicked", G_CALLBACK(fct_Advanced), (GtkWidget*) pCadre2);Merci d'avance pour votre aide
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8 pxgraph = gdk_pixbuf_new(GDK_COLORSPACE_RGB,FALSE,8,400,300); pixel = gdk_pixbuf_get_pixels(pxgraph); for(i=0; i<400*3*300; i++) { pixel[i]= 255; } graph = gtk_image_new_from_pixbuf(pxgraph); gtk_box_pack_start(GTK_BOX(prightVBox), graph, FALSE, FALSE, 0);
Partager