From: suchod on
comp lang tcl

starkit

i work with Debian/lenny and Tcl/Tk 8.4.

I had to produce a stand alone with Tcl/Tk. I decided to train myself
to starkits before starpacks.
I coded a mini script

set f [pwd] or set f [exec pwd]
pack [label .l -texvariable f]

named it myscript.tcl

supposing a directory tree such as /home/w/x/y/z 5 levels.

I copied myscript.tcl to each of the levels and runned it
with "./wish8.4 myscritp.tcl"

it worked perfectly.

then i made a starkit at the level /home/w

../sdx.kit qwrap myscript.tcl

it worked ok.

Now here is the my problem :

at each level the "wis8.4 myscript.tcl" gives the correct answer.

To the contrary when i utilize my starkit "myscript.kit" on the level
/home/w where it has been created it works and when i go down the
levels it answers only and constantly "/home" even if i call it from
/home/w/x/y for instance ???

I hope the above is "understandable" and maybe somebody can help me
with any type of advice.
thank you
jerome

From: Larry W. Virden on
On Jun 10, 11:39 am, suchod <such...(a)wanadoo.fr> wrote:

> I had to produce a stand alone with Tcl/Tk.  I decided to train myself
> to starkits before starpacks.

This is a great idea. By keeping things simple, you can work out the
simple problems.

> I coded a mini script
>
> set f [pwd]   or set f [exec pwd]
> pack [label .l -texvariable f]
>
> named it myscript.tcl

I followed along your instructions. I did, however, make 2 changes to
your script. My script reads
$ cat myscript.tcl
package require Tk
set f [pwd]
pack [label .l -textvariable f]
$


>
> supposing a directory tree such as  /home/w/x/y/z 5 levels.
>

So I created this type of directory structure

> I copied myscript.tcl to each of the levels and runned it
> with   "./wish8.4 myscritp.tcl"
>
> it worked perfectly.

I honestly didn't make copies of the file at all the levels - I just
used ../myscript.tcl and so forth to test.

>
> then i made a starkit at the level /home/w
>
> ./sdx.kit  qwrap  myscript.tcl
>
> it worked ok.
>
> Now here is the my problem :
>
> at each level the "wis8.4 myscript.tcl" gives the correct answer.
>
> To the contrary when i utilize my starkit "myscript.kit" on the level
> /home/w where it has been created it works and when i go down the
> levels it answers only and constantly "/home" even if i call it from
> /home/w/x/y for instance ???

In my case, when I typed ../../myscript.kit I ended up geting the
correct path. The fact that you don't get that is puzzling to me.

>
> I hope the above is "understandable" and maybe somebody can help me
> with any type of advice.
> thank you
> jerome

I suggest making certain that you really have "-textvariable" as the
argument to the label command. If you do, then I'm out of ideas. I'm
using Solaris rather than debian. Oh - what version of sdx.kit and
tclkit are you using?
From: suchod on
Le 06/10/2010 06:11 PM, Larry W. Virden a �crit :
> On Jun 10, 11:39 am, suchod<such...(a)wanadoo.fr> wrote:
>
>> I had to produce a stand alone with Tcl/Tk. I decided to train myself
>> to starkits before starpacks.
>
> This is a great idea. By keeping things simple, you can work out the
> simple problems.
>
>> I coded a mini script
>>
>> set f [pwd] or set f [exec pwd]
>> pack [label .l -texvariable f]
>>
>> named it myscript.tcl
>
> I followed along your instructions. I did, however, make 2 changes to
> your script. My script reads
> $ cat myscript.tcl
> package require Tk
> set f [pwd]
> pack [label .l -textvariable f]
> $
>
>
>>
>> supposing a directory tree such as /home/w/x/y/z 5 levels.
>>
>
> So I created this type of directory structure
>
>> I copied myscript.tcl to each of the levels and runned it
>> with "./wish8.4 myscritp.tcl"
>>
>> it worked perfectly.
>
> I honestly didn't make copies of the file at all the levels - I just
> used ../myscript.tcl and so forth to test.
>
>>
>> then i made a starkit at the level /home/wc
>>
>> ./sdx.kit qwrap myscript.tcl
>>
>> it worked ok.
>>
>> Now here is the my problem :
>>
>> at each level the "wis8.4 myscript.tcl" gives the correct answer.
>>
>> To the contrary when i utilize my starkit "myscript.kit" on the level
>> /home/w where it has been created it works and when i go down the
>> levels it answers only and constantly "/home" even if i call it from
>> /home/w/x/y for instance ???
>
> In my case, when I typed ../../myscript.kit I ended up geting the
> correct path. The fact that you don't get that is puzzling to me.
>
>>
>> I hope the above is "understandable" and maybe somebody can help me
>> with any type of advice.
>> thank you
>> jerome
>
> I suggest making certain that you really have "-textvariable" as the
> argument to the label command. If you do, then I'm out of ideas. I'm
> using Solaris rather than debian. Oh - what version of sdx.kit and
> tclkit are you using?

<<<<<<<<<<<<<<
1 when i first started myscript.kit in its own level i received an error
"could not read label" then i think it might be related to Tk. In
order to check i went to url "http://www.tcl.tk/starkits/" and
downloaded "clock" unwrapped it opened "clock.vfs/lib/app-clock/clock.tcl
and discovered "package require Tk" then i introduced it to
myscript.tcl, but forgot to tell you.
2 i verified "-textvariable" is ok
3 my sdx.kit version is "2008/02/24 19:32:02 37255-36179"
4 you are right, i copied your code and the invocation "./myscript.kit"
works fine in all levels.
5 BUT i was not clear enough. Even when "./myscript.kit" work fine in
all levels if you start it with double-clicking then it does work only
in the "mother level" and everywhere else i obtain "/home" !!!

So now we have a good solution but i cannot explain why the same good
solution does not work correctly by double-cliking ???

Let me thank you for your help and if you have any idea about this
double-cliking i will be very interested in hearing from you
regards
jerome


From: Larry W. Virden on
On Jun 10, 2:02 pm, suchod <such...(a)wanadoo.fr> wrote:

> 5 BUT i was not clear enough. Even when "./myscript.kit" work fine in
> all levels if you start it with double-clicking then it does work only
> in the "mother level" and everywhere else i obtain "/home" !!!
>
>   So now we have a good solution but i cannot explain why the same good
> solution does not work correctly by double-cliking ???
> > - Show quoted text -

If double clicking the program shows /home, then that means that the
working directory for the .kit, at the time it was executed, was /
home.

I just copied myscript.kit into my Windows bin directory. I used
Windows Explorer to display that folder. I double clicked the icon
within that display - and it displayed my $HOME/bin as the path.

The only way I can see for it to always be showing the same path is
for the program to be in that folder at the time the code runs.

Could you perhaps have some sort of $HOME/tclshrc < http://wiki.tcl.tk/tclshrc
> that is changing directories before your code runs?

From: suchod on
Le 06/11/2010 01:37 PM, Larry W. Virden a �crit :
> On Jun 10, 2:02 pm, suchod<such...(a)wanadoo.fr> wrote:
>
>> 5 BUT i was not clear enough. Even when "./myscript.kit" work fine in
>> all levels if you start it with double-clicking then it does work only
>> in the "mother level" and everywhere else i obtain "/home" !!!
>>
>> So now we have a good solution but i cannot explain why the same good
>> solution does not work correctly by double-cliking ???
>>> - Show quoted text -
>
> If double clicking the program shows /home, then that means that the
> working directory for the .kit, at the time it was executed, was /
> home.
>
> I just copied myscript.kit into my Windows bin directory. I used
> Windows Explorer to display that folder. I double clicked the icon
> within that display - and it displayed my $HOME/bin as the path.
>
> The only way I can see for it to always be showing the same path is
> for the program to be in that folder at the time the code runs.
>
> Could you perhaps have some sort of $HOME/tclshrc< http://wiki.tcl.tk/tclshrc
>> that is changing directories before your code runs?
>

you are perfectly right. I came to the same conclusion but in a
different manner.

I utilize the file manager NAUTILUS. I observed that when myscript.kit
only answers "/home" the box named LOCATION on top of the file browser
show also "/". Then i opened /home/x on pressing the little triangles
left of the directory names and discovered that nothing changes in the
famous LOCATION box. And then i tried to go to /home/x/y but by
clicking on icon of the wanted directory and THEN (!!) the LOCATION box
was showing correctly "/home/x/y" !!! The next step was to try the
myscript.kit in all these "variations" and when the LOCATION box is ok
then myscript.kit works ok. !!!

It means then that LOCATION box is correctly updated if one clicks on
the directory icon, and is not updated "at all" if one presses the
expansion little triangles !!!

Although i do not understand why, at least the thing is working now
correctly.

I will of course, taking your advice go to"http://wiki.tcl.tk/tclshrc"
and see what can be done to "normalize" this situation.

Thank you again for your help
hoping i did not take too much of your time
friendly
jerome