Table – Fyne Golang GUI Tutorial 63

Table – Fyne Golang GUI Tutorial 63

Fyne Table is explained in this fyne golang example.
Fyne table is similar to fyne list. Except one thing that i.e. multiple rows and columns.

package main
// import fyne
import (
func main() {
    // New app
    a := app.New()
    // new title and window
    w := a.NewWindow("Table widget")
    // resize
    w.Resize(fyne.NewSize(400, 400))
    // create table widget
    // table is like list , just 2 values, instead of one
    table := widget.NewTable(
        // row and col . I want to create 3 row , 3 col
        func() (int, int) { return 3, 3 },
        // Now I want to specify widget. like label, checkbox
        func() fyne.CanvasObject { return widget.NewLabel("....") },
        // update/details data in widget
        func(i widget.TableCellID, obj fyne.CanvasObject) {
            // remember it is label and not newlabel
            // i is for index
            // i.col will set col value
            // i.row will present row value
            obj.(*widget.Label).SetText(fmt.Sprintf("%d %d", i.Col, i.Row))


Download Code

Fyne Golang GUI Course


Improved fyne documentation for free with videos.
Fyne table is another addition in our fyne examples series.
fyne widgets explained with the help of videos.
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: