-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwindow.go
43 lines (38 loc) · 1.23 KB
/
window.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package main
import (
"strconv"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/canvas"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/layout"
"github.com/go-vgo/robotgo"
)
const SimpleScriptName = "SimpleScript"
func createCurrentMousePosWindow(myApp fyne.App) fyne.Window {
mousePosWindow := myApp.NewWindow("Mouse pos")
textX := canvas.NewText("0", black)
textY := canvas.NewText("0", black)
go func() {
for {
x, y := robotgo.Location()
textX.Text = strconv.Itoa(x)
textY.Text = strconv.Itoa(y)
textX.Refresh()
textY.Refresh()
}
}()
mousePosWindow.SetContent(container.New(layout.NewHBoxLayout(), textX, textY))
return mousePosWindow
}
// func makeAppTabsTab(_ fyne.Window) fyne.CanvasObject {
// tabs := container.NewAppTabs(
// container.NewTabItem("Main", widget.NewLabel("Main")),
// container.NewTabItem("Script maker", widget.NewLabel("Script maker")),
// // container.NewTabItem("Tab 3", widget.NewLabel("Content of tab 3")),
// )
// for i := 4; i <= 12; i++ {
// tabs.Append(container.NewTabItem(fmt.Sprintf("Tab %d", i), widget.NewLabel(fmt.Sprintf("Content of tab %d", i))))
// }
// locations := makeTabLocationSelect(tabs.SetTabLocation)
// return container.NewBorder(locations, nil, nil, nil, tabs)
// }