Network Internet Images- Fyne GUI Golang tutorial 26

Network Internet Images- Fyne GUI Golang tutorial 26

Want to fetch images from internet ? You can easily do it in Fyne.

This tutorial is focused on displaying assets from internet.

 

package main
// import fyne
import (
"image/color"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/canvas"
)
func main() {
// New app
a := app.New()
// New Title and Window
w := a.NewWindow("Load images from internet")
// loading images/assets/icons from computer
//r, _ := plugin.LoadResourceFromPath("c:/assets/tree.jpg")
// Images/assets from internet
//r, _ := plugin.LoadResourceFromURLString("https://picsum.photos/200")
r, _ := fyne.LoadResourceFromURLString("http://placekitten.com/g/200/300")
// CAT API Free -- http://placekitten.com/g/200/300
// New Random image URL https://picsum.photos/200
img := canvas.NewImageFromResource(r)
textx:= canvas.NewText("my text change font", color.Black)
textx.TextStyle=
// Resize
w.Resize(fyne.NewSize(400, 400))
// Show and Setup content
w.SetContent(img)
w.ShowAndRun()
}

Download Code

Resource

 

Fyne Golang GUI Course

Tony BB
 

TonyBB is a Coach , marketer, hypnotist and a founder of RSKVF Production who specializes in providing simple, affordable, and easy to use solutions for Life.

Click Here to Leave a Comment Below 0 comments

Leave a Reply: