9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Kim Lassila <kim.lassila@gmail.com>
To: 9fans <9fans@9fans.net>
Subject: Re: [9fans] a simple graphical application in Go?
Date: Sun, 5 Apr 2020 07:11:37 +0300	[thread overview]
Message-ID: <A03C5635-F022-459A-8F61-D7EFE509469E@gmail.com> (raw)
In-Reply-To: <CAOk9ws34ucW-kN8FMo0DhfaSmC6Fwe+cLWM7YfuE1pEXewo=Fg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 865 bytes --]

On Apr 5, 2020, at 12:37 AM, Chris McGee <newton688@gmail.com> wrote:
> 
> You can try this Go library by mischief and some examples in the cmd package:
> https://bitbucket.org/mischief/draw9/src/default/ <https://bitbucket.org/mischief/draw9/src/default/>
Thank you, thank you! Here is the Go version of black.c:

package main

import (
	"bitbucket.org/mischief/draw9"
	"fmt"
	"image"
	"log"
	"time"
)

func main() {
	disp, err := draw9.InitDraw(nil, "", "black")
	if err != nil {
		log.Fatal(err)
	}
	screen := disp.ScreenImage
	rect := screen.R
	black := disp.Black
	screen.Draw(rect, black, nil, image.ZP)
	disp.Flush()
	time.Sleep(5 * time.Second)
	disp.Close()
	fmt.Println("rectangle was", rect)
}

One minor issue: the window is white after the program exits. Text doesn’t show until I hit the up and down arrow keys.

Kim

[-- Attachment #2: Type: text/html, Size: 9038 bytes --]

      parent reply	other threads:[~2020-04-05  4:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-04 13:54 Kim Lassila
2020-04-04 20:32 ` [9fans] " Jeremy Jackins
2020-04-04 21:50   ` Skip Tavakkolian
2020-04-05  4:15   ` Fazlul Shahriar
2020-04-05  4:37     ` Skip Tavakkolian
2020-04-06  9:58     ` Lucio De Re
2020-04-04 21:37 ` Chris McGee
2020-04-05  0:40   ` ori
2020-04-05  4:11   ` Kim Lassila [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=A03C5635-F022-459A-8F61-D7EFE509469E@gmail.com \
    --to=kim.lassila@gmail.com \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).