Advertisement
Guest User

Untitled

a guest
Sep 28th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. package main
  2.  
  3. import "github.com/dontpanic92/wxGo/wx"
  4. import "time"
  5.  
  6. var g wx.Gauge
  7.  
  8. type MyFrame struct {
  9. wx.Frame
  10. }
  11.  
  12. func (f *MyFrame) startUpload() {
  13. for {
  14. time.Sleep(time.Second)
  15. g.SetValue(g.GetValue() + 1)
  16. f.Refresh()
  17. f.Update()
  18. }
  19. }
  20.  
  21. func NewMyFrame() MyFrame {
  22. f := MyFrame{}
  23. f.Frame = wx.NewFrame(wx.NullWindow, -1, "Test Thread")
  24. mainSizer := wx.NewBoxSizer(wx.HORIZONTAL)
  25. g = wx.NewGauge(f, wx.ID_ANY, 100, wx.DefaultPosition, wx.NewSize(600, 40), 0)
  26. f.SetSizer(mainSizer)
  27. mainSizer.Add(g, 100, wx.ALL|wx.EXPAND, 50)
  28. f.Layout()
  29. go f.startUpload()
  30. return f
  31. }
  32.  
  33. func main() {
  34. wx1 := wx.NewApp()
  35. f := NewMyFrame()
  36. f.Show()
  37. wx1.MainLoop()
  38. return
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement