RE: RE: gtk thread begginer



my app is and it counts only to 3 and not to 999.
how can i do this?

thanks.:

#include<gtk/gtk.h>
#include<stdio.h>
#include<string.h>

GtkWidget *window;
GtkWidget *poruka;
GtkWidget *kredit;

void izrada_prozora(){

window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "ALLs JukeBOX 3");
gtk_container_set_border_width (GTK_CONTAINER (window), 50);
g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (gtk_main_quit), NULL);

kredit = gtk_label_new ("0");
gtk_container_add (GTK_CONTAINER (window), kredit);
gtk_widget_show (kredit);

gtk_widget_show(window);
}

void *argument_thread(void *args){
unsigned long int b=0;
char a[1000];

for(b;b<1000;b++){
b++;
sprintf(a, "%d", b);
gtk_label_set(GTK_LABEL (kredit), a);
g_usleep(1000000);
}

}

int main(int argc, char *argv[]){
gtk_init(&argc, &argv);

g_thread_init(NULL);
gdk_threads_init();


izrada_prozora();

g_thread_create(argument_thread, 0, 1, 0);

gdk_threads_enter ();
gtk_main ();
gdk_threads_leave ();
return 0;
}



--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.8.8 - Release Date: 14.2.2005




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]