RE: [tcltk-perl] Re: Perl/Tk Aqua progress?
Brought to you by:
hobbs
From: Konovalov, V. <vko...@sp...> - 2004-12-08 09:00:44
|
> > 1) How does Tcl::Tk interact with Perl/Tk submodules. For > example, I > > use Tk::ProgressBar::Mac to generate a progress bar. > However, when I > > try to use it with my mimimal changes, I get an error when > I attempt to > > call the widget. Do I need to remove or rewrite any > non-core widgets > > that my script uses in order to use Tcl::Tk? You can not use pure-perl perlTk widgets. However there exists a way to create pure-perl Tcl::Tk widgets. But this design not decided and it is not documented - so you can't use this either. However I hope to solve this within a month (or may be two), so expect positive answer to your question soon. But usually it is easier to use existing Tcl/Tk widget: Following one-liner on Win32 that shows BWidget's ProgressBar: perl -MTcl::Tk=:perlTk -we "$mw=tkinit;$mw->Declare('ProgressBar','ProgressBar',-require=>'BWidget');$m w->ProgressBar(qw/-maximum 1000 -variable/,\$r)->pack for 0..9; $r++,$mw->update for 0..1000;MainLoop" Note 'Declare' widget method of widget. It creates ProgressBar widget in Tcl::Tk It declares that widget of type 'ProgressBar' (1st arg) should use widget 'ProgressBar' (2nd arg) of Tcl/Tk and it requires 'BWidget' package (Tcl/Tk script will use 'package require BWidget') It provides great flexibility, and general Tcl/Tk widgets availability. Once invoked, you can use ProgressBar anywhere in your program. (it is called 10 times in my example) (note to myself -- should document 'Declare' method clearly (as TODO comment says)) > > > > 2) Does Tcl::Tk support drag and drop? I had to comment out the > > Tk::StartDrag and Tk::DragDrop calls in order for the script to run > > under Tcl::Tk. It was not implemented in Tcl::Tk's, so there is no perlTk compatibility WRT Tk::StartDrag and Tk::DragDrop As I currently understand, perlTk uses Drag-n-drop borrowed from Tix. There exists also drag-n-drop in BWidget Tcl/Tk's package. As using drag-n-drop from Tcl::Tk you can use either Tix one or BWidget's one. Both ways should be easily doable, Usually Tcl/Tk distribution comes with BWidget and without Tix. Please see BWidget's demo from your Tcl/Tk installation to see which drag-n-drop will be available to your Tcl::Tk scripts. > > 3) Are Pixmap window icons supported? they should be... What code is not working? > > I don't mind porting some of my code over to the Tcl::Tk > way of doing > > things, but I'm not fluent in Tcl or the way this module > does things, > > whereas I've been working with Perl/Tk for 3-4 years now. On first > > glance, aside from a few problems, my app runs well by > changing "use > > Tk;" to "use Tcl::Tk qw(:perlTk);", which is both surprising and > > encouraging. Good work to the team for making at least the initial > > stuff so easy! The key point here - anything that does not works with Tcl::Tk but works in perlTk could be easily adopted to Tcl::Tk. But with Tcl::Tk you will get more avilability in general. Also, it is planning to do distributions of Tcl::Tk with Tcl/Tk. Best regards, Vadim. |