Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
Pages: (3) </ 1 [2] 3 >/

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: tcl< Next Oldest | Next Newest >
mikshaw Offline





Group: Members
Posts: 4856
Joined: July 2004
Posted: May 01 2006,13:05 QUOTE

The PATH variable, as well as any other environment variable, can be set from anywhere.  Typically if you just need the change applied to the current shell you'd set and/or export the variable from the shell (in bash: export PATH="/opt/tcltk-8.4/bin:$PATH") and then start the application from that same shell.  This is one thing a shell wrapper will do, automating the task.  
If it's a change that you will need to make permanently, the typical location would be /home/dsl/.bash_profile for your user, or /etc/profile for all users.  .bashrc can be used instead of .bash_profile, but the new path will be added to $PATH every time you open a new shell. If you never use the console you could export it from .xinitrc instead, which would mean having only to restart X rather than drop to console, source .bash_profile, and then restart X.

Once wish is in your path, you will still need to modify the script, because it calls /usr/local/bin/wish8.1 specifically.  One common way to avoid this problem is to start the script with this instead:
Code Sample
#!/bin/sh
#\
exec wish "$0" "$@"
Note the commented backslash...this is vital to allow bash to run exec, but to prevent it from being rerun in wish.

The tkcon menu item/icon sets the path for the consoles, which is why that works. I didn't include wrappers for Tcl because that would be an extra complication just to make things more convenient for the newbie.  I assumed that a person who is scripting would already be familiar with common tasks like setting envrironment variables =o)


--------------
http://www.tldp.org/LDP/intro-linux/html/index.html
Back to top
Profile PM WEB 
jpeters Offline





Group: Members
Posts: 804
Joined: April 2006
Posted: May 01 2006,15:49 QUOTE

1. I set the path in bash: export PATH="/opt/tcltk-8.4/bin:$PATH"
2. I attempt to load "wish":
 
#!/bin/sh
#\
exec wish "$0" "$@"

This results in the terminal window closing and nothing happening

I assumed that a person who is scripting would already be familiar with common tasks like setting envrironment variables =o)  LOL
Back to top
Profile PM 
mikshaw Offline





Group: Members
Posts: 4856
Joined: July 2004
Posted: May 01 2006,17:23 QUOTE

That example of loading wish will not work from the commandline, if that's what you tried.  It's meant to replace "#!/path/to/wish" at the start of a script.  What it's doing is running the script initially with /bin/sh. Then sh will run the script ("$0") and any commandline parameters ("$@") with wish.  It's kinda sloppy, but it's necessary because wish is often installed in places other than /bin or /usr/bin, and using just #!wish doesn't work.  It could also be done with #!/usr/bin/env wish, but that assumes env is always in /usr/bin.

Can you now get an empty Tk window by running the command "wish" from a terminal?


--------------
http://www.tldp.org/LDP/intro-linux/html/index.html
Back to top
Profile PM WEB 
jpeters Offline





Group: Members
Posts: 804
Joined: April 2006
Posted: May 01 2006,18:22 QUOTE

"Can you now get an empty Tk window by running the command "wish" from a terminal?"

Yes, both from the terminal and the console. When I now write:

"button .hello -text "Hello, World!" -command { exit }
pack .hello
tkwait window . "

I get an empty window with Tkcon #2 at the top. The path to .button.tcl is:
/opt/tcltk-8.4/standard_libs/tk8.4

I'm guessing I should be seeing a button with "Hello, World!" on it.
Back to top
Profile PM 
clacker Offline





Group: Members
Posts: 570
Joined: June 2004
Posted: May 01 2006,19:09 QUOTE

I just tried this.  Loaded the tcltk-8.4.uci in the embeded version 2.3 of dsl and opened an xterminal.  Typed

export PATH=/opt/tcltk-8.4/bin:$PATH

then typed wish and used your example (without the surrounding quotes) in that same xterminal and it did make the button.
Back to top
Profile PM 
10 replies since April 30 2006,17:53 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

Pages: (3) </ 1 [2] 3 >/
reply to topic new topic new poll
Quick Reply: tcl

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code