-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGallery.go
More file actions
57 lines (37 loc) · 1.09 KB
/
Gallery.go
File metadata and controls
57 lines (37 loc) · 1.09 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package main
import (
// "fmt"
"io/ioutil"
"log"
"strings"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/canvas"
)
func galleryapp(w fyne.Window) {
w.CenterOnScreen()
w.SetFixedSize(true)
// w.Resize(fyne.NewSize(1000, 600))
root_src:="D:\\PEPCODING DEV\\HACKATHON 2\\Wallpaper";
files, err := ioutil.ReadDir(root_src)
if err != nil {
log.Fatal(err)
}
// var appendarray [] string
tabs := container.NewAppTabs()
for _, file := range files {
// fmt.Println(file.Name(), file.IsDir())
if !file.IsDir(){
extension:= strings.Split(file.Name(), ".")[1]
if extension =="jpg" || extension=="png"{
// appendarray = append(appendarray, root_src +"\\"+file.Name());
image:= canvas.NewImageFromFile(root_src +"\\"+file.Name())
tabs.Append(container.NewTabItem(file.Name(), image))
}
}
}
tabs.SetTabLocation(container.TabLocationLeading)
galleryContainer := (tabs)
w.SetContent(container.NewBorder(panelContent, nil, nil, nil, galleryContainer),)
w.Show()
}