For Programmers: Free Programming Magazines  


Home > Archive > PerlTk > January 2007 > Refreshing GUI









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Refreshing GUI
evntm

2007-01-12, 7:02 pm

How do I refresh a window with updated info after a runwhen my GUI is
up running some application?
For example in The Dirtree, How can I update the directory structure
when a new directory is created, same for FileSelect.
Thanks
evntm

zentara

2007-01-13, 8:02 am

On 12 Jan 2007 15:21:33 -0800, "evntm" <yvntem@hotmail.com> wrote:

>How do I refresh a window with updated info after a runwhen my GUI is
>up running some application?
>For example in The Dirtree, How can I update the directory structure
>when a new directory is created, same for FileSelect.
>Thanks
>evntm


Alot depends on what OS you are on, but basically you can run a timer
that refreshes it every desired time interval.

You setup a timer to run the sub that builds your dirlist or filelist,
then $mw->update. Updating every second dosn't use much cpu.

Some OS's have "watcher daemons" that can watch a directory for changes.
Many people like to use rsync for this. Then you have to work out
a scheme for reading the rsync output, and use that to signal a refresh.

It's possible, but not easy enough to show in a simple snippet.

See:
http://perlmonks.org?node_id=583571

http://perlmonks.org?node_id=391870

There are modules for Rsync, but you will need some ingenuity
to glue it properly into your Tk script.

The easiest is just a timed update.



--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html
evntm

2007-01-26, 7:02 pm


But I see FileSelect has this capability why not Dirtree? Is there a
way to implement the same in Dirtree?


Thanks
evntm
On Jan 13, 2:59 am, zentara <zent...@highstream.net> wrote:
> On 12 Jan 2007 15:21:33 -0800, "evntm" <yvn...@hotmail.com> wrote:
>
> that refreshes it every desired time interval.
>
> You setup a timer to run the sub that builds your dirlist or filelist,
> then $mw->update. Updating every second dosn't use much cpu.
>
> Some OS's have "watcher daemons" that can watch a directory for changes.
> Many people like to use rsync for this. Then you have to work out
> a scheme for reading the rsync output, and use that to signal a refresh.
>
> It's possible, but not easy enough to show in a simple snippet.
>
> See:http://perlmonks.org?node_id=583571
>
> http://perlmonks.org?node_id=391870
>
> There are modules for Rsync, but you will need some ingenuity
> to glue it properly into your Tk script.
>
> The easiest is just a timed update.
>
> --
> I'm not really a human, but I play one on earth.http://zentara.net/japh.html


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com