Multiple container items referring to the same canvas.Image
only render once
#4442
-
The following code only renders one image item, the other one is blank (Fyne v2.4.2): func main() {
a := app.New()
w := a.NewWindow("Test")
img := canvas.NewImageFromFile("testdata/image-01.jpg")
img.SetMinSize(fyne.NewSize(320, 240))
c := container.New(layout.NewVBoxLayout(), img, img)
w.SetContent(c)
w.ShowAndRun()
} I made a copy of the image and passed it as follows: img2 := *img
c := container.New(layout.NewVBoxLayout(), img, &img2) This seems to work but I got the following warning: Why is this, and what would be the best work-around? |
Beta Was this translation helpful? Give feedback.
Answered by
andydotxyz
Dec 7, 2023
Replies: 1 comment 1 reply
-
Objects can only be visible in one place at a time, if you want to display the same image twice you will need two |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
srackham
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Objects can only be visible in one place at a time, if you want to display the same image twice you will need two
canvas.Image
objects referring to the same file/resource/pixels.