raybies has asked for the wisdom of the Perl Monks concerning the following question:

this is probably an obnoxious question that's been asked a mazillion times, but if I wanted to display my data visually in perl, how could I go about doing that?

Kinda how Java has SWT?

I've looked at Perl/TK, GTK and QT, but I just haven't been able to commit to those systems, because i feel like I'm being boxed into a nonportable set of routines that only work if I've installed the kitchen sink and have a given OS. Also I don't know how well supported they are--or if they'll just fall off the face of the earth next week, and well, I like the idea of being able to port my perl program between linux and windows-pc.

I've actually found that using raw html is the most portable format I can find once my data's altogether and I want to import it into say a Word document, or show it on the web. The main problem I have with raw html is that it's read-only--display data only--but no chance to grab this chunk and put it here, or feedback without creating webbuttons, and programming through a webserver, but then it's not attached to my perl program any longer, cuz it's data.

I guess I really don't know what I want--or if there's such a thing as an open visual data format, but it'd be nice if Perl supported this nonexistent idea. :)

Thoughts?

Replies are listed 'Best First'.
Re: Visual Perl
by zentara (Cardinal) on Oct 18, 2010 at 20:18 UTC
    By "graphics" I mean display of bitmaps, pictures, vector images and 3d models, etc.....I'm very interested in visualizing information in windows, tables, text boxes that can be selected and extracted and controled, but I don't need hi-performance graphics.

    I would suggest the Tk::Zinc canvas.

    The reasons:

    1. is it is well supported. Zinc is used is used by CENA for aircraft radar. It works anywhere you can use Perl/Tk, Python/Tk,or Tcl/Tk ( and maybe others I'm unaware of) See TkZinc Homepage

    2. it is the best thought out canvas when it comes to zooming and rotations of your data objects. It allows grouping of items, group rotations, precise storing and setting of positional data and rotation data, for individual items and groups. You can make "windows" in the canvas to display other widgets, like textboxes or listboxes; or you can make your custom Zinc child widgets. See Strangely addictive Tk::Zinc based game for an example of how good Zinc can look.

    3. It comes with a great pdf documentation, and the maillist is quite helpful.

    See a modest Zinc tutorial and look thru the great demo that comes with the module.

    The only requirement of yours which it dosn't meet is "vector graphics".... but you could implement your own vector drawing language with the rotation tools that Zinc provides.


    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh
Re: Visual Perl
by kcott (Archbishop) on Oct 18, 2010 at 17:43 UTC

    It's been many years since I wrote any Java: I'm guessing SWT is either an amalgamation of Swing and AWT or a general term to describe the two used together.

    Qt does require libraries to be installed so portability could be an issue. Wx (which you didn't mention) is in much the same boat as Qt library-wise. I'm not too familiar with Gtk: I did play around with coding this directly in C some years ago and had a few portability issues with MSWindows but things may have improved since then. I've been using Perl/Tk for many years and there's very little in the way of portability problems: I currently write one script and run that under both MSWindows and Cygwin without any problems (you also get a native look-and-feel depending on which OS you're using in much the same way as I remember AWT/Swing doing).

    There's a utility called pp which allows you to create binaries and then use them on a machine that doesn't have Perl. I use this quite successfully with Perl/Tk GUIs allowing me to install working applications on MSWindows boxes that don't have Perl running. I haven't tried it with any of the other toolkits mentioned earlier (Qt, etc.).

    HTML has to be the most portable with pretty much everyone having access to a web browser. I'll simply concur with the limitations and drawbacks you've already pointed out.

    -- Ken

Re: Visual Perl
by luis.roca (Deacon) on Oct 18, 2010 at 17:43 UTC

    Just to be clear: Do you want to create dynamic information design like graphs or maps where users can input data and have it respond on the fly? Or, are you looking to create detailed display illustrations/art?

    I don't think Perl/Tk will help you much since it's more for GUI design. (At least it's a lot more than you seem to need.) Other far more enlightened monks will be able to answer your question better than I but off the top of my head maybe read up on GD or writing SVG files using Perl. I'm looking to work with SVG files and there seem to be a number of modules that would be helpful. Since it's XML you would be able to work with the data in a way that's pretty accessible. — Maybe that could work for you?

    Again, I think a few more details about the kind of graphics you're looking to create would be helpful.

    Good luck!
    "...the adversities born of well-placed thoughts should be considered mercies rather than misfortunes." — Don Quixote

      I'm not sure I can be entirely clear. I'm discovering that the moment I decide "This is what I want..." and then I find it, I start to think, "Boy! Now if only it had this feature too." :)

      Right now I'm really struggling with a portable way to visually display information. It would be nice if I could take some feedback from the display once it was created, like say, a visual merge tool might employ. That sort of level of control. Graphics are not that important at this point, but then I usually throw out that possibility altogether when I approach a problem, due to the fact that perl's so text/data centric.

      I wonder if there's a convenient table of the possible visual tools, their portability across systems, their feature limitations and such. I found myself digging through a lot of libraries but couldn't tell if, for example, Wx was coming or going, in terms of adoption, etc. And I'm curious if google's doing anything interesting in this arena as well with their new OS/aps... but that's mostly me getting sidetracked. :)

        You say "a portable way to visually display information" and "Graphics are not that important at this point". No doubt I don't understand you because those seem contradictory to me. Can you clarify?

Re: Visual Perl
by FloydATC (Deacon) on Oct 18, 2010 at 20:21 UTC
    Choose your tools depending on what kind of data you want to show.

    I'm currently working on a network map with a few thousand nodes and chose to implement it using a combination of HTML, SVG (Scalable Vector Graphics) and Javascript. CSS takes care of visual feedback such as highlighting focused objects, AJAX sends updates back and forth between server and clients, presenting content such as context menus, site/host details and performance graphs.

    Everything is based on W3C standards so it works with all GUI browsers except the Microsoft one.

    -- Time flies when you don't know what you're doing
Re: Visual Perl
by Anonymous Monk on Oct 18, 2010 at 17:29 UTC

    Yikes, you think *word* is a portable format? Different versions of the same application can't even read it!

    I mostly use Tk myself. Works great across XP, Ubuntu and Win98.

      it's not that MS Word is portable. It's a tool imposed upon me from work. I find however that using clever CSS-HTML I can create tables that import directly into Word without the need of any special formatting, so I can do all my work in perl, and occasionally I put it into report format for these other bozos. :)

      The key being that perl allows me to keep my data in data format, that is easily manipulatable, but not necessarily easy to visualize. If I had my way I'd make everyone use a commandline interface, but for some reason with modern guis, that is almost taboo--if you want to create a tool for the whole team.

Re: Visual Perl
by jakeease (Friar) on Oct 19, 2010 at 02:32 UTC
    You might give GD and GD::Graph a look, though you may decide it has the kitchen-sink defect.