I have been trying to develop an application to read barcodes and QR codes for a while and I found gozxing but I could not find how to access the camera.
I try to apply the scanning logic to this code down below
package main
import (
"log"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/layout"
"fyne.io/fyne/v2/theme"
"fyne.io/fyne/v2/widget"
)
func makeUI(tabs *container.AppTabs) *fyne.Container {
return container.New(layout.NewGridLayout(1),
tabs)
}
func makeUI2(entry *widget.Entry, button *widget.Button) *fyne.Container {
return container.New(layout.NewVBoxLayout(),
entry,
container.NewVBox(
button,
),
)
}
func main() {
myApp := app.New()
myWindow := myApp.NewWindow("Kütüphane")
myWindow.Resize(fyne.NewSize(300, 400))
// db, err := sql.Open("sqlite3", "kutuphane.db")
// defer db.Close()
// if err != nil {
// log.Fatal(err)
// }
input := widget.NewEntry()
input.SetPlaceHolder("Kitap Numarasını Girin")
tabs := container.NewAppTabs(
container.NewTabItemWithIcon("Ana Sayfa", theme.HomeIcon(), container.NewVBox(widget.NewButton("Barkodu Okut", func() {
w2 := myApp.NewWindow("Kütüphane")
w2.Resize(fyne.NewSize(200, 300))
w2.SetContent(makeUI2(input, widget.NewButton("Kaydet", func() {
})))
w2.Show()
log.Print("Clicked")
}))),
container.NewTabItem("Ayarlar", container.NewVBox()),
container.NewTabItem("Aktifler", container.NewVBox()),
)
tabs.SetTabLocation(container.TabLocationBottom)
myWindow.SetContent(makeUI(tabs))
myWindow.Show()
myApp.Run()
}
I expected it to open and work properly, but I couldn't because I didn't understand it. If it doesn't work, I can even do it with C code.