I am trying to use atk package in Go
(version go1.19.3 linux/amd64 on Debian Stable) to create a simple GUI application. I am using following code to add a Label and an Entry field:
package main
import (
"github.com/visualfc/atk/tk"
"fmt"
)
func MainWindow() {
var mainWin = tk.RootWindow()
var lbl = tk.NewLabel(mainWin, "Enter Name:")
var err = lbl.SetBackground("blue") // working;
if err != nil {fmt.Println(err.Error())}
err = lbl.SetForground("red") // working;
if err != nil {fmt.Println(err.Error())}
var ent = tk.NewEntry(mainWin)
err = ent.SetBackground("blue") // not working;
if err != nil {fmt.Println(err.Error())}
err = ent.SetForeground("red") // working;
if err != nil {fmt.Println(err.Error())}
tk.NewHPackLayout(mainWin).AddWidgets( lbl, ent)
mainWin.Center(nil)
mainWin.ShowNormal()
}
func main() {
tk.MainLoop(MainWindow)
}
The program builds and runs without any error. However, although both the label colors and foreground entry filed color are correctly set, the background color for entry widget is not set:
I have checked the documentation here.
Where is the problem and how can it be solved?