ck

chw

 What:  ck
 Where: http://www.ch-werner.de/ck/ 
 Description: Curses Tcl Toolkit .  Tk like toolkit but in character mode,
        using XPG4 curses.
        Runs on Linux, AIX, HP-UX, DEC Unix, SCO OpenServer, FreeBSD, and
        Win32.
        Currently at version 8.0 .
 Updated: 09/2001
 Contact: mailto:[email protected] 

LV I attempted to build Ck today, to try out CkChat. However, I can't get cwsh to run. I had to hack the Makefile to get it to compile (I'm on SPARC Solaris 2.8, and am using Tcl 8.4.1). When I run it, I see:

 Can't find a usable ck.tcl in the following directories: 
    /usr/tcl84/lib/ck8.0 /projects/xopsrc/lib/ck8.0 /projects/lib/ck8.0 /project

s/xopsrc/library /projects/library /projects/ck0/library /ck0/library

 /projects/xopsrc/lib/ck8.0/ck.tcl: wrong version of Ck loaded (8.0): need 8.0
 wrong version of Ck loaded (8.0): need 8.0
    while executing
 "error "wrong version of Ck loaded ($c.$d): need 8.0""
    invoked from within
 "if {$a == 7} {
    if {$c != 4} {
        error "wrong version of Ck loaded ($c.$d): need 4.X"
    }

Here's the interesting part:

 $ ls -l /projects/xopsrc/lib/ck8.0/ck.tcl
 -rw-r--r--   1 lwv26    xopsrc      2665 Jan 28 07:42 /projects/xopsrc/lib/ck8.0/ck.tcl

Victor Wagner You should read this file rather than list it and find out. why it thinks that version is wrong and ck.tcl is unusable. It was quite easy to fix in particular case, but quite complicated to write better version of version test which would suite everybody. Really, Ck should have its own versioning scheme, and not require version of Tcl be exactly same as version of Ck


08feb03 jcw - If anyone wants it, I had a copy of Ck adapted to build with stubs and Tcl 8.4 lying around, and have placed the sources (plus a Linux build, IIRC) on the web at [L1 ].


2003-10-22 VI : Thanks for that. Related is the modified Ck - can't find the author name at [L2 ]. If anybody can the sources using CVS out of there, let me know. I tried the DOS box port from there and it works cool!

It is my site Victor Wagner. I don't put my name here, because I believe that anyone can find it out from domain name, and if not - write to webmaster of this domain. Which is my home machine anyway.

I built jcw's version from above. It refuses to build a shared version for me (Redhat 7.1). And the only way I can get cwsh to start is to start it in the library directory. Otherwise I get the dreaded can't find ck.tcl that LV mentions above.


24 September 2004: Victor Wagner has created his own public CVS for Ck [L3 ] [L4 ].

There are also Debian packages available.

09 May 2005 VK: both links above are invalid. Also I did not succeeded finding ck elsewhere on that site; is ctk80.tar.gz is better version?


Ck requires much work to be drop-in replacement for Tk even for application which do not use images, canvases and fonts extensively (these features obviously cannot be used in character mode)

Partial list of missing features

  • [event] command
  • [text] undo feature
  • [labelframe] and [pannedwindow] widgets
  • [entry] validation.

Really, almost everything which appears in Tk since 8.0 release haven't been ported to Ck. Most worse, Ck is not objectified, which complicates borrowing source from recent Tk.


So, is the idea that, with ck, one could create CUI applications?


Yes ck allows you to put buttons and frames and such on a text console either the real console or an xterm. It is very handy for complex user interfaces that don't have X11. You know what would make this really valuable? Make cwsh a standalone executable requiring nothing other than libncurses. No /usr/local/lib/ck8.4/frame.tcl and so on. Actually I guess you'd need the libncurses and the libtcl but nothing else. That would make it really functional. No complex install necessary, just copy the cwsh over. Also if cwsh became "close" to wish. I.e., if I could take a wish .tcl file and minimally strip it, have it run fine on cwsh. Then spruce it up with some cwsh extras to make it shine. I could have 1 code base that served both consoles and X11. hmm...just ideas...


2018-10-24 — CREDIL modified it to compile with Tcl 8.6: [L5 ].


2020-11-07 The current release of the vanillawish/vanillatclsh derivative of AndroWish contains a somewhat modernized ck for POSIX (Linux, MacOSX) and Windows (vanillatclsh only) platforms. Both, the Linux and MacOSX version even support Emoji in a terminal, provided that the ncurses library is modern enough and the terminal emulation capable of displaying Emoji (gnome-terminal, MacOSX terminal). The Windows version is built with pdcurses (https://pdcurses.org ) and supports only Unicode BMP.
This still isn't perfect, see https://asciinema.org/a/nAqW9U4HIlFwDUzBhbjeHphuJ for a short demo.

JM says: I was just about to ask for a demo!
Thanks

and here is also CkChat:

 $ ./vanillatclsh-78555c39f0-linux32 builtin:cwsh ckchat

ckchat_screenshot


2021-08-04 An even more complex use case of ck is described in LUCK in it's TUI variant (lucktui) which is a text based front end to a local or remote build service. see https://asciinema.org/a/gNg7QznCHEql74SPLo9mcPSst for a screen cast.


2022-10-06 Here's a minimalist watch utility

package require Ck
text .t -state disabled -wrap none
pack .t -side top -fill both -expand 1
bind .t <q> {set ::done 1}
bind .t <Q> {set ::done 1}
bind .t <Escape> {set ::done 1}
bind .t <Return> {set ::done 1}
focus .t
set ::done 0
proc trigger2sec {} {
    set ::done 0
    after 2000 trigger2sec
}
trigger2sec
update
while {!$::done} {
    catch {exec sh -c $argv </dev/null} out
    set here [.t index insert]
    .t configure -state normal
    .t delete 1.0 end
    .t insert end $out
    .t configure -state disabled
    catch {.t mark set insert $here}
    catch {.t see insert}
    vwait ::done
}
curses purgeinput

2023-03-31 Another complex use case of ck is described in topcua where ck is the basis of a simple text mode OPC/UA browser. An early version is demonstrated in another screen cast, see https://asciinema.org/a/d4O2RHNjGsEZKWfniq9TgAhFO

See also