set_uk has asked for the wisdom of the Perl Monks concerning the following question:
I have an app built using Class::DBI::Oracle that i am now building a GUI for. I dont have much experience using Perl TK and have been searching about looking for modules and shortcuts that might speed me along the route.
Tk::TM appears to be outdated and not maintained.
Tk::DBI::Form supports MYSQL and not Oracle.
What advice do you have that might help the creation of a Perl Tk Class::DBI::Oracle based application.
Simon
Re: Perl::TK Class::DBI Oracle
by pg (Canon) on Dec 07, 2003 at 03:38 UTC
|
If I am the author of Tk::DBI::From, I will seperate data and presentation classes, and make sure the presentation class provides a common interface towards data classes. If I only have the time to implement interface to MySQL, as least other people can easily add their data classes for other databases, according to the open interface I defined. Unfortunately that module was developed in a closed structure.
You said that you have the database portion implemented already, and is seeking for Tk GUI part. I think Tk::Table meets the general requirement of rendering database table pretty well. I made up some demo:
use Tk;
use Tk::Table;
use Data::Dumper;
use strict;
my ($row, $col);
#data, in your case, come from database
my @cell_vars;
foreach $row (0 .. 9) {
my @row_vars;
foreach $col (0 .. 9) {
push @row_vars, $row * $col;
}
push @cell_vars, \@row_vars;
}
#presentation
my $mw = MainWindow->new;
$mw->geometry("600x250");
my $table = $mw->Table(-rows => 9, -columns => 9,
-scrollbars => "se",
-fixedrows => 1, -fixedcolumns => 1,
-takefocus => 1)->pack;
foreach $col (1 .. 9) {
my $col_header = $mw->Button(-text => "Column " . $col);
$table->put(0, $col, $col_header);
}
foreach $row (1 .. 9) {
my $row_header = $mw->Button(-text => "Row " . $row);
$table->put($row, 0, $row_header);
foreach $col (1 .. 9) {
my $cell = $mw->Entry(-width => 10, -textvariable => \$cell_va
+rs[$row][$col]);
$table->put($row, $col, $cell);
}
}
#manipulate data
$cell_vars[5][6] = "foo";
MainLoop;
As you can see, it is very easy to set/get the cell values, and modification to data is automatically reflected on screen (you don't need to do anything). If you only want to display data, but not editing, replace Entry with Label.
Good Luck! | [reply] [d/l] |
Re: Perl::TK Class::DBI Oracle
by Flame (Deacon) on Dec 07, 2003 at 03:26 UTC
|
To begin with, you might want to take a look at POE depending upon the complexity of your application. POE has techniques for keeping the GUI alive during long database queries and works very well with Tk, I've taken this approach myself on occasion.
My code doesn't have bugs, it just develops random features.
Flame
| [reply] |
Re: Perl::TK Class::DBI Oracle
by mattr (Curate) on Dec 07, 2003 at 12:36 UTC
|
Hello,
I am now in a similar situation where I am architecting an app which will combine database and windows-style gui using a smart spreadsheet or POS-like interface.
I have been looking at Tk::Zinc, (used to be openatc.org/zinc) which was mentioned recently, with tutorial by zentara and a YAPC::EU presentation. It still has some problems on W2K apparently (I have gotten Japanese text editable in Win98 with Tk but had trouble building in Cygwin) though there is a temporary workaround through Tk. One interesting thing I saw in the OpenATC/TkZinc related sites were the use of Perl for animation (can't find the code though) of drag and drop inside a GUI application, and that it was fast enough to run an aircraft control display. This would let you for example have a simple spreadsheet display but also you could make an object-oriented display with small panels that can be expanded to show more information (there is a demo).
Anyway, I've done some scouring today. Take a look at Jouke's FAQ and this thread for some more info. Also Win32::GUI::Grid is apparently a spreadsheet component (I also remember someone made one that fits in a webpage with javascript maybe). I'll paste my notes below for you, sorry they are not HTMLized.
I think you should note that PerlQt and PerlTkZinc have problems on Windows. Tk, Gtk, and especially WxWindows (which can do ActiveX and OpenGL with wxperl now) seem the most useful. And there are both free and commercial GUI designers now for wxperl. I can't tell if the interesting wxwindows grid module has a perl api yet. Also Win32::GUI which has a localization problem for me, but it has a highly tested grid module too which might be what you want. Anyone with more info please post!
Matt R.
PERL GUI NOTES - mattr at telebody.com 2003.12.7
META-INFO
http://perlmonks.org/index.pl?node_id=302083 talk about perl gui kits 2003-11
http://perlmonks.org/index.pl?node_id=108708 **** PERL GUI FAQ ****
TKZINC
http://www.tkzinc.org/documents/NR99-814.pdf OpenATC/TkZinc paper
http://www.tkzinc.org/zinc/ TkZinc, the GUI system accessible with perl cf. Tk::Zinc
http://www.tkzinc.org/zinc/faq-en.html
http://zentara.net/ Zentara monk's TkZinc tutorial
http://www.tls.cena.fr/divisions/PII/toccata/
http://www.tls.cena.fr/divisions/PII/toccata/composants/digistrips.html info (fr)
http://www.tls.cena.fr/divisions/PII/recherches/interaction/digistrips/ more info (fr)
http://www.google.com/search?sourceid=navclient&q=digistrips search
http://www.tls.cena.fr/divisions/PII/toccata/digistar/ digi* libraries
http://www.tls.cena.fr/divisions/PII/toccata/digistar/digilistes/digilistes.html
http://www.tls.cena.fr/divisions/PII/produits/produits.html#perl-anim Overview
http://www.tls.cena.fr/products/ivy/ Ivy software bus
http://www.tls.cena.fr/divisions/PII/recherches/perception/animations.html perl based animation
http://www.tls.cena.fr/divisions/PII/Rapports/NR99-813.html useful results paper on hci in English
http://www.tls.cena.fr/divisions/PII/digistrips/index_e.html Good English Digistrips Site
http://www.tls.cena.fr/divisions/PII/recherches/interaction/digistrips/index_e.html
http://www.tls.cena.fr/divisions/PII/recherches/interaction/virtuosi/ Virtuosi app.
PERL/TK
http://www.perl.com/pub/a/2001/03/gui.html perl/tk article
PERL/GTK
http://personal.riverusers.com/~swilhelm/gtkperl-tutorial/ gtk/perl tutorial
http://imagic.weizmann.ac.il/~dov/freesw/gtk/gtk-image-viewer/ gtk-image-viewer
http://perlmonks.org/index.pl?node_id=302083
http://mail.gnome.org/archives/gtk-perl-list/
Re: What ISN'T good about PerlGTK?
We write a majority of our GUI components in Perl. To distribute our applications, we need to produce a single executable file. When I tried to convert an application from PerlTk to PerlGTK, the perl interperter didn't have any problems with the new GUI library, but the compiler refused to compile the app. That's why we stick with PerlTK.
You can use Glade and proably any tools that talk to glade (I have not tried the ones you mention) to generate code that works with gtk-perl. I understand the easiest way is to generate the XML with glade, then read that into your perl program.
To answer some of your specific questions, Gtk+ exists on Linux and Windows. A Win32 version of the perl bindings should be out any time now. You do not need Gnome for Gtk+. You do need Gnome if you use Gnome features (i.e. you use Gnome widgets in your design).
Gtk-perl is faster/crisper and more powerful libs than Tk.
PERLQT
http://perlqt.sourceforge.net/ PerlQT + QT Designer
-- comes with a RAD gui ide
-- site says windows unsupported though some doing it, maybe with cygwin
https://mail.kde.org/pipermail/kde-perl/2003-April/000722.html windows armtwisting thread, legal questions
WXPERL - most portable and object oriented, often updated
http://wxperl.sf.net/ wxperl - now has opengl canvas and actvex!
http://wxperl.sourceforge.net/support.html
http://wxglade.sourceforge.net/ free gui builder!!
http://www.perl.com/pub/a/2001/09/12/wxtutorial1.html wxperl tutorial
http://www.wxwindows.org/ wxwindows homebase, info on activex/opengl modules
http://www.wxwindows.org/screen09.htm wxwindows grid spreadsheet module set
Win32::GUI
http://dada.perl.it/ Win32::GUI
http://www.bahnhof.se/~johanl/perl/Loft/ Perl Loft
http://perso.club-internet.fr/rocherl/Win32GUI.html The author hp!
http://www.jeb.ca/faq/Win32-GUI-FAQ.html Win32::GUI FAQ
http://sourceforge.net/projects/perl-win32-gui Win32::GUI - Bug label can't handle Japanese
http://www.codeproject.com/miscctrl/gridctrl.asp used in Win32::GUI::Grid
-- Finally Win32::GUI::AxWindow is in CPAN. Check it out.
http://search.cpan.org/~lrocher/Win32-GUI-AxWindow-0.06/
For who doesn't know it yet, it enables ActiveX controls in the Win32::GUI interface, soo you can load Internet Explorer, Adobe Acrobat Reader, etc...
-- PerlCOM can let you talk to ActiveX/COM objects
PERL/TK
http://perlmonks.org/index.pl?node_id=181977 perl/tk tutorial
http://search.cpan.org/search?mode=module&query=Tk perl/tk docs
http://perlmonks.org/index.pl?node_id=266105 perl/tk prettifying it
http://www.cpan.org/authors/id/C/CL/CLAIRD/ptkFAQ.html outdated perl/tk FAQ
comp.lang.perl.tk newsgroup
-- easier to get support than for gtk
PRIMA
http://search.cpan.org/search?mode=module&query=Prima Prima GUI toolkit -- very new
http://www.prima.eu.org/ Prima perl gui with ide etc for X and win32
OPENTHOUGHT
http://openthought.net/ javascript gui in browser
GUI APP FRAMEWORKS
POE http://poe.perl.org/
http://search.cpan.org/~rcaputo/POE-0.27/
PERL GUI BUILDERS
Tk: SpecPerl http://keck.ucsf.edu/~kvale/specperl.html
specPerl 1.0 is a modification of specTcl 1.1 which emits code suitable for perl/Tk, instead of Tcl/Tk.
Tk: Guido http://guido.sourceforge.net/
Gtk: Glade-Perl http://www.glade.perl.connectfree.co.uk/index.html
Gtk: PerlComposer http://perlcomposer.sourceforge.net/
Win32::GUI: TheGUILoft http://www.bahnhof.se/~johanl/perl/Loft/
Win32::GUI: GB ftp://ftp.wh.whoi.edu/pub/gb109.zip
wxperl: wxDesigner http://www.roebling.de/
wxperl: wxGlade http://wxglade.sourceforge.net/
dfm2gui http://homepage.tinet.ie/~jmcnamara/perl/dfm2gui.html
dfm2gui is a Perl program that converts Delphi/C++Builder Forms to
Win32::GUI templates. This allows you to use Delphi or C++Builder to design
Win32::GUI windows and packages.
PERL COMPILERS/BUNDLERS
perlcc builtin
perl2exe http://www.perl2exe.com/ bundler
PerlApp http://www.activestate.com/Products/Productivity/Perl_Dev_Kit/
InnoSetup http://www.jrsoftware.org/isinfo.php free installer, many nat'l langs!
- looks great, all win versions, single exe, uninstall, wizard, pascal scripts
ISTool http://www.istool.org/ GUI frontend for InnoSetup script creation
ScriptMaker, http://www.tafweb.com/scriptmaker.html very useful GUI adjunct to Inno Setup
Other installers and info at http://www.wxwindows.org/technote/install.htm
(Ghost Installer, NSIS, InstallMaker, InstallAnywhere)
TKZINC ON WINDOWS INFO
TkZinc trouble/workaround on W2K. cf. mailing list 9-10/2003
https://secure.tls.cena.fr/Services/Sympa/arc/zinc/2003-10/msg00031.html
I have some perl/tk code that I would like to port to Zinc getting more
graphic capabilities. But also I'd like to use this code under Win2000 too.
Is there any possibility to run under win2000/xp ? Any workaround ? Any
examples ?
welcome...
Currently we are not able to make TkZinc working on windows with perl.
But Patrick tried a port to ptk8.4 (which is only in beta stage, and not
already easy to use). When this port to ptk 8.4 will be available, this
should solve the pb of tkZinc with perl on windows. But this may take
some time...
Intuilab (a startup using TkZinc) developped some nice workaround which
seems to work fine on windows: they use TkZinc with tcl, and the Tcl::Tk
module from the CPAN, they wrap all TkZinc methods to call the tcl
interpreter.
I am not sure they finished all the work, but some TkZinc perl demos
were working, and they are ready to make this code freely available. In
fact an early release is available in the "shared web" section of the
mailing list manager: https://secure.tls.cena.fr/Services/Sympa/arc/zinc
Alex Lemort is the author of this code, and may be he can correct me if
I wrote an error...
From: Lemort Alexandre
We have a trick to run perl/Tk Zinc under Windows: we have a wrapper to
convert perl calls into tcl calls ..... and thanks God and P. Lecoanet,
tcl-Zinc works under Windows ..
It works well under Win XP and it's buggy under win2000
Perl-Zinc for windows is available in documents section of mailing
list, but you have to subscribe to zinc-mailing
Sources and explanations are available at:
http://www.intuilab.com/downloads/windows
or
https://secure.tls.cena.fr/Services/Sympa/arc/zinc
In sources, you will find:
- some zinc demos: tiger, color, item, triangles
- svg2zinc: to display SVG file with Zinc, (written by C. Mertz)
UPDATED June 28, 2005:Thanks for the comment christopheM! Replaced s/openatc/tkzinc/g (hope the links work). -Matt
http://www.wxwidgets.org/ | [reply] |
|
Just two comments about Tk::Zinc
It is now working on windows quite well. we are using in "production" mode at IntuiLab
The new website of Tk::Zinc is now www.tkzinc.org (a wiki, with a cvs and a bugzilla)
Cheers
| [reply] |
|
|