This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Information on running tcl/tk with cygwin?



----- Original Message -----
From: Karr, David <david.karr@cacheflow.com>
To: <cygwin@cygwin.com>
Sent: Friday, April 27, 2001 3:38 PM
Subject: RE: Information on running tcl/tk with cygwin?


  > No, not tkdiff.  It's an interface to "diff3" that I'm looking for.
  > Nevertheless, I believe I found the script I needed, but now I'm a
little
  > concerned about the hacks I had to do to get it to work at all (and I
  > haven't fully tested it yet).  I discovered that I have to be very
  > particular about how I provide paths to the tcl script.  Obviously, I
have
  > to change "wish" to "cygtclwish80".  I might create a symlink, so I
don't
  > always have to hack third-party scripts.  I also discovered, as you
clearly
  > did, that you even have to be careful how you invoke the script.  For
  > instance, if you execute it through the Cygwin PATH, and you have it in
  > "/home/myname/bin", then it will fail to find it.  You have to execute
it
  > with the Windows path.
  >
  > The other annoyance is that "puts" seems to have no effect, whether I
write
  > to stdout or stderr.  Nothing comes out.


Windows applications don't normally have a console attached to
them.

The cygnus version of "wish" is no exception.  It is a normal
Windows application.  The Windows version of wish does have
a hidden/fake console (that is created by wish) that can be
displayed if you add a

    console show

to your application.  Note, the above command is only valid
when you run your script under Windows, so you will want to
check in the code to make sure that you are running under
Windows and not under Unix (ie check the value of the
"tcl_platform(platform)" variable).  See the code below...


  > -----Original Message-----
  > From: Troy Noble [mailto:troy.noble@channelpoint.com]
  > Sent: Friday, April 27, 2001 12:27 PM
  > To: 'Karr, David'; 'cygwin@cygwin.com'
  > Subject: RE: Information on running tcl/tk with cygwin?

     ...

  > I recall having to do something to get it to work with cygwin
  > since line 4 of the script reads:
  >
  > exec wish "$0" -- ${1+"$@"}
  >
  > and of course wish is really called cygwish80.exe in the cygwin
  > distro.  Could probably solve it with a symlink or an alias
  > of wish that refers to cygwish80.exe, I will leave that up to
  > you to try.
  >
  > If I recall, I just commented out that line and then I start
  > the script using an alias that I define in my .bashrc:
  >
  > alias tkdiff="cygwish80.exe -f /cygwin/usr/local/bin/tkdiff.tcl"
  >
  > Troy

What I ended up doing was to create a symlink "wish" that
refers to cygwish80.exe as Troy mentioned.

And then I replaced the "$0" argument with `cygpath -w $0`
so that it uses the Windows style path.  Again, see the
code below for an example...

Also note that cygwish80 is not a cygwin application
and doesn't understand a cygwin style path.  If you need
to refer to a file within your application, use a Windows
path.

If you have any questions, let me know...

--Mark



#!/bin/sh
#-*-tcl-*-
# the next line restarts using wish \
exec wish `cygpath -w $0` ${1+"$@"}

if {$tcl_platform(platform) == "windows"} {
    console show
}

puts "This is text should appear in the console window..."

after 5000 {set flag 0}
vwait flag

puts " "
puts "Now let's create a text window..."
puts " "
puts "and send output to it."

after 3000 {set flag 0}
vwait flag

    button .quit -text "Exit" -command exit
    pack .quit -side bottom

    frame .puts
    text .puts.text -xscrollcommand ".puts.h_scrollbar set" \
                    -yscrollcommand ".puts.v_scrollbar set" \
                    -relief sunken -wrap none \
                    -height 20

    scrollbar .puts.v_scrollbar -command ".puts.text yview" -orient vertical
    scrollbar .puts.h_scrollbar -command ".puts.text xview" -orient
horizontal

    pack .puts.v_scrollbar -side right  -fill y
    pack .puts.h_scrollbar -side bottom -fill x
    pack .puts.text        -side left -fill both -expand yes

    pack .puts             -side bottom -fill both -expand yes \
                           -anchor s

########################################################################
########################################################################

proc myPuts {args} {

    if {[lindex $args 0] == "-nonewline"} {
        set newline ""
        set args [lrange $args 1 end]
    } else {
        set newline "\n"
    }
    if {[llength $args] == 2} {
        set text "[lindex $args 1]$newline"
    } else {
        set text "[lindex $args 0]$newline"
    }

    if {[winfo exist .puts.text]} {
        .puts.text insert end $text
        .puts.text yview moveto 1.0
    } else {
        puts $text
    }
    update idletasks
}

########################################################################
########################################################################

raise .

myPuts " "
myPuts "And now, a \"myPuts\" will output text to this area... "
myPuts " "



--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]