Resize Entry, Button – Fyne GUI Golang tutorial 50

Resize Entry, Button – Fyne GUI Golang tutorial 50


Fyne Resize Entry

Create New Entry/Input widget
entry := widget.NewEntry()

Set place holder Text
entry.SetPlaceHolder(“Enter your name”)

Resize widget Size
entry.Resize(fyne.NewSize(250, 30))

Position of widget on parent window
entry.Move(fyne.NewPos(40, 50))

Fyne Resize Button

Create a Button and Set button label. Here “submit” is my button label

btn_submit := widget.NewButton("Submit", nil) 
Resize button size according to your needs.

 btn_submit.Resize(fyne.NewSize(150, 30)) 

Set position of your button on parent window

 btn_submit.Move(fyne.NewPos(40, 200))   


Source Code

package main
// import fyne
import (
func main() {
    // New app
    a := app.New()
    // New Window & title
    w := a.NewWindow("Resize any widget")
    //Resize main/parent window
    w.Resize(fyne.NewSize(400, 400))
    // 1st Widget Entry
    entry := widget.NewEntry()
    entry.SetPlaceHolder("Enter your name")
    entry.Resize(fyne.NewSize(250, 30)) // my widget size
    entry.Move(fyne.NewPos(40, 50))     // position of widget
    entry_email := widget.NewEntry()
    entry_email.SetPlaceHolder("Enter your email")
    entry_email.Resize(fyne.NewSize(250, 30)) // my widget size
    entry_email.Move(fyne.NewPos(40, 100))    // position of widget
    entry_address := widget.NewEntry()
    entry_address.SetPlaceHolder("Enter your name")
    entry_address.Resize(fyne.NewSize(250, 30)) // my widget size
    entry_address.Move(fyne.NewPos(40, 150))    // position of widget
    // button
    btn_submit := widget.NewButton("Submit", nil)
    btn_submit.Resize(fyne.NewSize(150, 30)) // my widget size
    btn_submit.Move(fyne.NewPos(40, 200))    // position of widget
    //show and run


[easy_media_download url=”” text=”Download Code” color=”red_darker”]

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: