[ANN] tk9.0: The CGo-free, cross platform GUI toolkit for Go

462 views
Skip to first unread message

Jan Mercl

unread,
Sep 28, 2024, 2:04:22 PM9/28/24
to golang-nuts

Robert Engels

unread,
Sep 28, 2024, 2:29:50 PM9/28/24
to Jan Mercl, golang-nuts
Very cool!

> On Sep 28, 2024, at 1:04 PM, Jan Mercl <0xj...@gmail.com> wrote:
>
> http://modernc.org/tk9.0
>
> --
> You received this message because you are subscribed to the Google Groups "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAA40n-XU3EHEks%2B9fgVGaPk4ZdnmWNQCiHFwYLpKNn1Th4Bfmw%40mail.gmail.com.

Brian Candler

unread,
Sep 28, 2024, 4:09:09 PM9/28/24
to golang-nuts
Aside: on front page: "Viewing this on go.pkg.dev?"

Actually I was viewing it on pkg.go.dev :-)

Jan Mercl

unread,
Sep 28, 2024, 4:36:13 PM9/28/24
to Brian Candler, golang-nuts
On Sat, Sep 28, 2024 at 10:09 PM 'Brian Candler' via golang-nuts
<golan...@googlegroups.com> wrote:

> Aside: on front page: "Viewing this on go.pkg.dev?"
>
> Actually I was viewing it on pkg.go.dev :-)

The text in the picture tries to nudge you into expanding the
README.md section on go.pkg.dev, where it is collapsed by default. I
think it's a good introduction to the package to see some short demo
codes alongside the screenshots, but that opportunity can be easily
missed if one dives, head first, into the godocs.

The README.md is however also visible, not collapsed, at
https://gitlab.com/cznic/tk9.0, where the "click this" does not really
apply, hence the condition.

Compromises all the way down ;-)

Jan Mercl

unread,
Sep 28, 2024, 4:45:54 PM9/28/24
to Brian Candler, golang-nuts
On Sat, Sep 28, 2024 at 10:09 PM 'Brian Candler' via golang-nuts
<golan...@googlegroups.com> wrote:

> Aside: on front page: "Viewing this on go.pkg.dev?"
>
> Actually I was viewing it on pkg.go.dev :-)

Thanks to D. Honnef on Slack for revealing to me the [invisible to me]
difference between go.pkg.dev and pkg.go.dev. Fix coming.

Mandolyte

unread,
Oct 2, 2024, 9:06:42 AM10/2/24
to golang-nuts
It has been a long time since I have done any Go work, so probably my ignorance... but I did the following:
- in an empty folder
- copied the hello.go from the examples folder
- copied the go.mod file from repo root folder
- ran `CGO_ENABLED=0 go run hello.go`
- with this result:
```
$ CGO_ENABLED=0 go run hello.go
package command-line-arguments
imports modernc.org/tk9.0
imports modernc.org/tk9.0: import cycle not allowed
$
``` 
What did I do wrong?

On Saturday, September 28, 2024 at 2:04:22 PM UTC-4 Jan Mercl wrote:
http://modernc.org/tk9.0

Jan Mercl

unread,
Oct 2, 2024, 9:18:41 AM10/2/24
to Mandolyte, golang-nuts
On Wed, Oct 2, 2024 at 3:07 PM Mandolyte <ceci...@gmail.com> wrote:

> What did I do wrong?

Copying the go.mod file effectively declares the code in hello.go to be in package modernc.org/tk9.0.
That's the package hello.go imports, hence the import cycle. This works here:

jnml@t3610:~/tmp$ mkdir tk
jnml@t3610:~/tmp$ cd tk
/home/jnml/tmp/tk
jnml@t3610:~/tmp/tk$ ls -la
total 8
drwxr-xr-x  2 jnml jnml 4096 Oct  2 15:15 .
drwxr-xr-x 17 jnml jnml 4096 Oct  2 15:15 ..
jnml@t3610:~/tmp/tk$ cp ~/src/modernc.org/tk9.0/_examples/hello.go .
jnml@t3610:~/tmp/tk$ go mod init example.com/hello
go: creating new go.mod: module example.com/hello
go: to add module requirements and sums:
go mod tidy
jnml@t3610:~/tmp/tk$ go mod tidy
go: finding module for package modernc.org/tk9.0
go: found modernc.org/tk9.0 in modernc.org/tk9.0 v0.29.1
jnml@t3610:~/tmp/tk$ CGO_ENABLED=0 go run hello.go
jnml@t3610:~/tmp/tk$

Hope this helps.

-j

Mandolyte

unread,
Oct 2, 2024, 9:25:24 AM10/2/24
to golang-nuts
Worked! Thanks

Nikolay Dubina

unread,
Oct 14, 2024, 1:35:49 PM10/14/24
to golang-nuts
wow, impressive. but how does this work without C? don't you have to link to some standard OS rendering frameworks which are most likely in C? or do you communicate through syscalls? 

Brian Candler

unread,
Oct 14, 2024, 3:15:39 PM10/14/24
to golang-nuts

robert engels

unread,
Oct 14, 2024, 3:28:23 PM10/14/24
to Brian Candler, golang-nuts
This what it look like… it transpiles the libX library (on linux and osx anyway), in order to bind to the X Window system.

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.

Jan Mercl

unread,
Oct 14, 2024, 3:30:33 PM10/14/24
to Brian Candler, golang-nuts
On Mon, Oct 14, 2024 at 9:16 PM 'Brian Candler' via golang-nuts
<golan...@googlegroups.com> wrote:

> Or it could be like https://pkg.go.dev/modernc.org/sqlite, which took the Sqlite C source code and transpiled it into pure Go.

It's both, depending on target. The targets supported by
ebitengine/purego[0] link dynamically to the C libs at runtime. The C
dynamic libs are embedded in the executable.

The remaining ones are transpilled to pure Go and are doing syscalls.

[0]: https://github.com/ebitengine/purego?tab=readme-ov-file#supported-platforms

Jan Mercl

unread,
Oct 14, 2024, 3:34:27 PM10/14/24
to robert engels, golang-nuts
On Mon, Oct 14, 2024 at 9:28 PM robert engels <ren...@ix.netcom.com> wrote:

> This what it look like… it transpiles the libX library (on linux and osx anyway), in order to bind to the X Window system.

darwin/macOS is supported by the purego project and on that target
Tcl/Tk uses Aqua, not XQuartz(X11) for the GUI.
Reply all
Reply to author
Forward
0 new messages