cwarn23 Posted January 13, 2009 Share Posted January 13, 2009 Hi and I have almost made a php-gtk search engine indexer but just need this last line of code converted from php to php-gtk. I have found the below example and modified it to represent every piece of my script in a much simplified format but my question is on line 7 (bottom code box) how do I make the script display the changes to the $label object. This is because it can take days to fully execute my script so continual display updating/flushing is needed. Now I have tried a wide range of things and from what I can see, if I use the below line, it only flushes what is in the text que for the echo statement. flush(); Also I have tried each of the following without any success. gtk.gdk.flush(); Display.flush(); Gtk.Gdk.Display.flush(); gtk.gdk.Display.flush(); GTK.GDK.Display.flush(); Also in addition to that I tried using the ob_flush() function. So for that I place ob_start(); at the beginning of my code and on line 7 of the below code I added ob_flush(); <?php function updateCounter($label) { // Set the label text to the current text plus one. $label->set_text($label->get_text() + 1); // line 7 /* --------------------------------------------- somehow flush above object & qued data here. --------------------------------------------- */ sleep(5); } // Create a window to hold the label. $window = new GtkWindow(); $window->connect_simple('destroy', array('Gtk', 'main_quit')); // Create a label. $label = new GtkLabel('0'); // Create a button that will be used to increment the counter. $button = new GtkButton('Click Me!'); $button->connect_simple('clicked', 'updateCounter', $label); //Group objects into a box $vBox = new GtkVBox(); $vBox->pack_start($label); $vBox->pack_start($button); // Add the box to the window. $window->add($vBox); // Show the window and start the main loop. $window->show_all(); Gtk::main(); ?> Does anybody know what I can do to make the $label object display/flush as I have spent hours on this and still got nowhere. Please help. Link to comment https://forums.phpfreaks.com/topic/140641-php-gtk-flush-label-object/ Share on other sites More sharing options...
cwarn23 Posted January 14, 2009 Author Share Posted January 14, 2009 ??? Please help. I have also just tried $label->flush(); but it makes the program freeze. I have also found that $window->flush(); makes the program crash. Link to comment https://forums.phpfreaks.com/topic/140641-php-gtk-flush-label-object/#findComment-736781 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.