Re: set_text() flickering
| From: | Benjamin Smith | Date: | Thu, 23 Jun 2005 22:15:57 +0000 |
| Subject: | Re: set_text() flickering | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-5888@lists.php.net to get a copy of this message | ||
I simply reduce the number of times I refresh the screen. This code updates
$widget 1 time per second while downloading stuff from an http socket
connection:
EG:
<?
Function UpdateScreen()
{
while(gtk::events_pending())
gtk::main_iteration();
}
// SNIP //
$bytes=0;
while ($line=fgets($http_connection, 1024))
{
$bytes+=strlen($line);
$in.=$line;
if ($lastupdate!=mktime())
{
$lastupdate=mktime();
$widget->Set_Text("$bytes bytes downloaded");
UpdateScreen();
}
}
?>
1x/second doesn't look too bad, and is responsive enough that users don't
think it's "frozen"...
-Ben
On Thursday 23 June 2005 11:17, Brian Stumm wrote:
>
> What can be done to reduce flickering when using set_text() to change
> text on the screen programmatically. I'm using several set_text() calls
> in a function I've added to the gtk::main via gtk::timeout. There are
> probably 6 or so set_text calls in my function and its being called
> about 3 times per second. I've looked into gtk::layout->freeze() but it
> did nothing. Any ideas?
>
> --
> Brian Stumm
> ETS - Energy Technology Systems, Inc
> bstumm@energytechnologysystems.com
> http://energytechnologysystems.com
>
> --
> PHP-GTK General Mailing List (http://gtk.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--
"I kept looking around for somebody to solve the problem.
Then I realized I am somebody"
-Anonymous