macosgofyne

Go Fyne Window Crashes with too many logs


I am coding in Go and using Fyne to display a window. I have tasks that log info to this window. When I make the tasks log strings to the window at high volume the window is no longer readable and gets scaled weird. I also get the error:

UNSUPPORTED (log once): POSSIBLE ISSUE: unit 0 GLD_TEXTURE_INDEX_2D is unloadable and bound to sampler type (Float) - using zero texture because texture unloadable

I am on a MacBook Air. However I want to have a window that supports any computer, thats why I picked Fyne. How can I simply have a window with a scrollview that I can log short strings to? I added images of the broken UI and how it looks with a small amount of logs.

image

images

func appendLog(message string) {
    // I want the new text to appear at the top
    // Window is of type: *widget.Label
    process.Window.SetText(message + "\n" + Window.Text)
}

func openNewDialog(a fyne.App, taskgroup string) {
    w := a.NewWindow("Hi")

    // Set the window size
    w.Resize(fyne.NewSize(400, 300))

    // Create label and buttons
    hello := widget.NewLabel("Hello User!")
    stopButton := widget.NewButtonWithIcon("Stop tasks", theme.CancelIcon(), func() {
        
    })
    stopButton.Importance = widget.HighImportance

    // Create a checkout label
    checkoutCount := widget.NewLabel("0 checkouts")
    checkoutCount.TextStyle = fyne.TextStyle{Bold: true}
    checkoutCount.Alignment = fyne.TextAlignCenter

    // Arrange content in a vertical box layout
    content := container.NewVBox(
        container.NewHBox(stopButton, checkoutCount),
        hello,
    )

    // Wrap the content in a scroll view
    scrollableContent := container.NewVScroll(content)

    w.SetCloseIntercept(func() {
        
    })

    // Set the scrollable content as the window's content and show the window
    w.SetContent(scrollableContent)
    w.Show()
    Window = hello
}

Solution

  • Use the List widget, that is designed for performance. It looks like you have so much data that if you try to render it all at once in a Scroll the system can’t cope - but a List widget renders only what is on screen.