in reply to Re: TK Help
in thread TK Help
Thanks a lot,
it works fine
Thanks,
Srikrishnan
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: TK Help
by thundergnat (Deacon) on May 04, 2010 at 14:10 UTC | |
Some further commentary. A Tk::Text may not be your best choice to display and / or manipulate simple lists. It is possible to use them, but probably not optimal. You should likely at least make it a ROText to prevent unwanted modification. One of the List widgets seem like it would be better suited though. Avoid cluttering up your script with globals. For small programs it isn't a big deal but as your script grows it will get harder keep track of them all. I like to use a single global hash to hold all of my Tk widget references. It keeps them tidy, makes it obvious what they are and generally makes for easier maintenance. This is just a personal preference but has been born through hard experience. Narrow the scope of your subroutines. A sub called openFile() shouldn't do anything but return a file name (or file handle) you really shouldn't be doing any widget creation or text manipulation or any thing else in there. It will make debugging much easier down the road. Trust me... You probably should install and use perltidy. It can really help make your code more readable. If you want to be able to rearrange the order of your list of files you can do it elegantly with drag and drop. Here's a minimal example loosely based on your script using everything I mentioned above. (I was bored :-)
| [reply] [d/l] |
by srikrishnan (Beadle) on May 06, 2010 at 07:01 UTC | |
Hi, Thanks for your great piece of work (really it is very useful for me, I am searching and researching for such a tool for very long time) I dont have any great documentation of perl/Tk with me. So I tried from my own so far and got lot of frustration. But your help is very great to me. Thanks a lot, srikrishnan | [reply] |
by afoken (Chancellor) on May 06, 2010 at 07:45 UTC | |
I dont have any great documentation of perl/Tk with me. So I tried from my own so far and got lot of frustration. You are not alone. I wrote some tiny Perl/Tk based tools, but the lack of a USABLE documentation for Perl/Tk drove me mad each time. I used Google a lot, and "Mastering Perl/Tk" (dated 2002), and of course perlmonks, but I found only fragments and a lot of cargo cult. The original TCL/Tk documentation may be helpful for someone who has worked with TCL, but it was not really useful for me, because I still fail to understand the deeper magics in Perl/Tk. It would be really great if some people could rework the Perl/Tk documentation in a way that it can be used stand-alone. The partly auto-generated documentation is not really helpful. For something complex as Perl/Tk, a really good documentation is needed. The DBI documentation is an example for how the Perl/Tk documentation should look like. I know that some people think that Perl/Tk is dead, and GTK or some other toolkit should be used. But I think the main reason for that is the lack of good documentation. Alexander
-- Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-) | [reply] |
by srikrishnan (Beadle) on May 07, 2010 at 04:01 UTC | |
by srikrishnan (Beadle) on May 08, 2010 at 04:24 UTC | |
Hi thundergnat Again I thanks you for your sample. From the sample you have given, i got a idea of using "Listbox" option for my requirement. Also I have tried that with success Below I have pasted my final completed code, may be it would be useful for somebody
I have learned the following new things from your code 1. gif as a data within perl script 2. -multiple file selection option in "getOpenFile" 3. DragDrop and DropSite modules 4. Different way of coding with Tk Once again thanks for teaching me all these things from a discussion Thanks Srikrishnan R. | [reply] [d/l] |