Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: TclTk interface with Perl code, is it possible?

by Marshall (Abbot)
on Jan 13, 2012 at 16:02 UTC ( #947765=note: print w/replies, xml ) Need Help??


in reply to TclTk interface with Perl code, is it possible?

Wow! Your post covers a lot of ground!

As far as making a .exe for Windows, I would give a "thumbs up" to the Active State PerlApp program. Over the last decade plus, these folks have improved this thing so that it works pretty well now and I am user. The most basic Active State devkit will set you back a couple of hundred bucks, but in a professional environment this will save a lot of hassle and aggravation!

You don't say what you are using now for building .exe's. One of the issues with a Tk based .exe is getting all of the necessary stuff into the .exe. When you run from your environment just "use Tk;" may be all you need because many widgets that are used are found dynamically during run-time. When I write Tk code destined for a .exe, I reflexively just put in a "use Tk::Label;" or whatever whenever I use a new widget in the code. That is one way to "force" the Label widget into the .exe.

However, Active State has developed a number of heuristics that scan the source code and automatically include the necessary widgets! This is very helpful! The alternative is to run the .exe, exercise all possible widgets to make sure that they are there and do something to get the "missing ones" when a run-time bomb happens - adding a "use" statement in the source code is, I believe better than adding command line compile options. However, it is even more robust to have Active State figure this out at "exe build time". In the old days, I'd miss one and have to repeat the build, test, modify cycle many times.

Anyway having the "smart" PerlApp that knows about Tk methods saves a lot of hassle and prevents errors of omission that are only apparent at run-time.

One advantage of using an older toolkit, like Tk is that there are a lot of books and examples available. I liked "Mastering Perl/Tk" by Steve Lidie and Nancy Walsh. This will show you how to write a lot "smarter", easier to understand and ultimately less code for the same job. Build "widget factories" for similar things.

My experience with writing GUI's is that the amount of time that I spend planning the GUI is far, far more than the actual coding of the basic layout. I spend a lot of time with "pencil and paper". The #1 tip: draw a picture of what you want on a scratch pad and use more frames to get the geometry to work out! The most used geometry (simple pack, instead of grid or others) has served me well although GUI development is not my primary coding focus.

The aggravating parts that consume most of the time are dealing with various screen resolutions and things like mouse focus and binding issues. I'm not sure how much a GUI builder would help with that?, if at all.

  • Comment on Re: TclTk interface with Perl code, is it possible?

Replies are listed 'Best First'.
Re^2: TclTk interface with Perl code, is it possible?
by exilepanda (Pilgrim) on Jan 13, 2012 at 17:35 UTC
    Yes, I found that PerlApp is a nice stuff for pack up the script. I just quite unsure how to build the GUI in a fast way with Perl codes.

    I do experience how to write Perl/Tk codes, but just too time consuming. This will not be the end product, the task force will just take this for *prototype running and loads of change is coming ahead for sure.

    * The prototype application could at lease show some interaction when click on here, or mouseover there..

      Again, my GUI I/F's takes 2-3 weeks or more typically a month to plan out how they work. A few days or even a week to code the plan is not that significant. The 2 weeks to a month deciding how it will work is the most "design effort" and that part is hard. You just will not come up with a good GUI, if you "slap things together" - the planning part is the most part. The implementation part is the least part.
      I would go with the Active State Komodo full blown IDE. This will cost some bucks (many bucks), but you will get something for those bucks. These people will talk to you on the phone and get you going. Doing it "cheap" doesn't seem to be the main parameter here - "hey, boss I need a $700 program to do my job" - Bingo! I would "punch that ticket" just to get on with the show.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://947765]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (2)
As of 2018-11-15 02:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My code is most likely broken because:
















    Results (179 votes). Check out past polls.

    Notices?