I've started down the mildly ambitious road of writing my own GUI ftp client. So far it's four boxes and a file select dialog. eventually I plan to set up two windows one to browse my pc and another to browse the remote. As well as config files to store site info. My question relates to file browsing on tk.

Are their any widgets or code examples of embeddable file navigators written in Tk. I've taken a look at Tk::DirTree and Tk::DirList, but neither works well as a file navigator as each requires a root directory to be set and can only(apparently) browse downward from that root, and lists dont collapse, etc etc, and they are not that attractive anyhow. Am i missing a better option?

#!/usr/bin/perl use Net::Ftp; use Tk; my $top = new MainWindow; my $l_ftpsite = $top->Label(-text=>"Site")->pack; my $entry_ftpsite = $top->Entry(-textvariable=>\$ftpsite)->pack; my $l_username = $top->Label(-text=>"Username")->pack; my $entry_username = $top->Entry(-textvariable=>\$username)->pack; my $l_password = $top->Label(-text=>"Password")->pack; my $entry_password = $top->Entry(-textvariable=>\$password)->pack; my $l_directory = $top->Label(-text=>"Directory")->pack; my $entry_directory = $top->Entry(-textvariable=>\$directory)->pack; my $browse = $top->Button ( -text=>"Browse..", -command=> sub{ my $filename = $top->getOpenFile( +); ftp_me($username,$password,$ftpsit +e,$directory,$filename); } )->pack(); MainLoop; sub ftp_me{ my ($username,$password,$ftpsite,$directory,$filename) = @_; $ftp = Net::FTP->new($ftpsite, Debug => 0); $ftp->login($username,$password); if (defined $directory) { $ftp->cwd(q|$directory|); } $ftp->put($filename); $ftp->quit; }

BTW, I'm aware of the lack of error checking and am working on that :) this was just a test case.


In reply to need advice on my Tk ftp client by thunders

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.