5 ms·
I use Tk routinely in Scheme; there is no Tcl in my code, but Tk is a very nice (though basic) GUI kit, and my programs work on Linux, BSD, MacOS, and Windows.
by vincent-manis 28d ago
I use Tk routinely in Scheme; there is no Tcl in my code, but Tk is a very nice (though basic) GUI kit, and my programs work on Linux, BSD, MacOS, and Windows. Other commenters have mentioned that Python ships with Tkinter, a library module that interfaces to Tk. I believe Ruby does the same. Hell, if you're programming in Cobol, you can have Tk (as long as your Cobol allows you to call C). You do not have to love Tcl to love Tcl/Tk.
- em-bee 28d agoin what way is Tk basic? can you elaborate? also what are your thoughts on the issues with python as mentioned in the article? how do the scheme bindings compare?
- piloto_ciego 28d agoThis is a fun idea! Are you using Guile-tk?
- ofalkaed 28d ago>you can have Tk (as long as your Cobol allows you to call C). No C required, you can just connect to the UI through a socket and often skip the FFI completely. This is my preferred way to use Tk and I don't even consider anything else unless there is a reason. Working this way also has the nice side effect of making the application UI agnostic.
- WalterGR 28d agoBut then you have an entire front end written in Tcl or some other non-COBOL language (to continue the above example,) right? Or is there a way to run Tk as a daemon?
- ofalkaed 28d agoBelieve you have to do that anyways unless you are going to create full language bindings as tkinter and the like do. I don't know the Tk API in full but I don't believe it provides ways to create widgets, just interact with them more directly. Perhaps someone more knowledgeable will fill in the gaps here, I learned what I needed of the Tk API and called it good.
- em-bee 28d agothat sounds interesting. can you give an example please?
- ofalkaed 28d agoPureData is a good example.
- forinti 28d agoWhen I first found out about Tcl/Tk, it was used to give a GUI to programs written in C. I've used Tk with Tcl and many times with Perl too.
- kevin_thibedeau 27d ago> interfaces to Tk It interfaces to its own internal Tcl interpreter that runs Tk. You can even feed it arbitrary non-Tk commands to eval. This is a legacy of the trouble Perl/Tk had splitting it out as an independent library which the Tcl devs didn't want to support.
- fuzztester 27d ago>Python ships with Tkinter, a library module that interfaces to Tk. I believe Ruby does the same. Perl too, IIRC.
- so-cal-schemer 26d agoA collection of Tk resources for Scheme: https://wiki.tcl-lang.org/page/Scheme https://wiki.tcl-lang.org/page/Scheme This is quite old, but I always remember seeing it in the BSD packages collection: https://conservatory.scheme.org/stk/ https://conservatory.scheme.org/stk/ Then there is Portable Scheme / Tk, a library for several Scheme implementations: https://wiki.call-cc.org/eggref/5/pstk https://wiki.call-cc.org/eggref/5/pstk PS/Tk provides an interface to the Tk toolkit, and is an effective tool for creating graphical interfaces. (import pstk) (tk-start) (tk/pack (tk 'create-widget 'button 'text: "Hello" 'command: (lambda () (display "Hello world") (newline))) 'padx: 20 'pady: 20) (tk-event-loop) And a recent walk-through: Learn Scheme by Example: Tk GUI with Chicken Scheme https://blog.matthewdmiller.net/learn-scheme-by-example-tk-gui-with-chicken-scheme https://blog.matthewdmiller.net/learn-scheme-by-example-tk-g...
- so-cal-schemer 26d agohttps://cdn.netbsd.org/pub/pkgsrc/current/pkgsrc/lang/STk/index.html https://cdn.netbsd.org/pub/pkgsrc/current/pkgsrc/lang/STk/in... STk is a Scheme interpreter which can access to the Tk graphical package. Concretely it can be seen as the John Ousterhout's Tk package where the Tcl language has been replaced by Scheme. The Scheme interpreter is now R4RS conformant. This release provides an efficient object oriented system called STklos. STklos is a full OO system with multi-inheritance, generic functions, multi-methods and a true meta object protocol.