Hi Guys,
I’m building a GUI for my robot.  I’m using Windows, so found lxn/walk.   
Working from the examples, I built a GUI which did all that I want right 
now.  I developed it in the main() function, just like the examples; but 
for the actual robot, I want it to run in its own goroutine with the code 
in a separate package.  Well, I can’t make that work.  I can’t even get it 
to work as a goroutine in main().
The minimal example code below demonstrates the problem.  The main() 
function has two ways to start the GUI.  If I run the “Gui()” version.  The 
GUI appears on the screen as expected and the controls function.  However, 
the subsequent 5 second Sleep and Println() don’t begin to run until I 
close the GUI window by clicking the X.  If I run the “go Gui()” version, 
 The GUI does not appear on the screen, but the code does continue and 
prints after the 5 second sleep.
I expect that it is possible to do what I want (i.e.  "go Gui” with 
continuation to the sleep and Println).  I am pretty much a newbie, but I 
have written a number of relatively complex goroutines that don’t have this 
problem.
I’m running on Windows 10 (x64) with go 1.6.2 on LiteIDE X29 and a very 
recent walk download.
I’m hoping someone can point out my possible naïve error, or maybe a link 
to some code that does what I want.
Thanks,
Alex

package main


import (

    "fmt"

    "time"

        . "github.com/lxn/walk/declarative"

)


func main() {

    //Gui() //  draws operative GUI window, but blocks from continuing to Sleep 
and Println

    go Gui() // doesn't draw GUI window. Continues and does Println after 5 
seconds


    time.Sleep(time.Millisecond * 5000)

    fmt.Println("testing")

}


func Gui() {

    MainWindow{

        Title:   "SCREAMO",

        MinSize: Size{600, 400},

    }.Run()

}


-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to