Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combining fc with fyne (proper) #2

Open
hippodribble opened this issue Sep 20, 2021 · 3 comments
Open

Combining fc with fyne (proper) #2

hippodribble opened this issue Sep 20, 2021 · 3 comments

Comments

@hippodribble
Copy link

AJ

Any way to make an app with a border layout with an fc Canvas as the central element?

The EndRun method may conflict with fyne.Window's ShowAndRun.

Congrats on a useful package!

glenn

@ajstarks
Copy link
Owner

I think they will integrate as fc is built on fyne fundamental objects.

@SteffenMahler
Copy link

Hi @hippodribble

The EndRun method may conflict with fyne.Window's ShowAndRun.

Then try this:

func main() {
    width := 500
    height := 500
    blue := color.RGBA{0, 0, 255, 255}
    white := color.RGBA{255, 255, 255, 255}

    canvas := fc.NewCanvas("hello", width, height)

    canvas.Circle(50, 0, 100, blue)
    canvas.Rect(20, 25, 20, 40, colornames.Green)
    canvas.CText(50, 25, 10, "hello, world", white)
    canvas.Image(50, 75, 200, 200, "earth.jpg")

    window := createWindow(canvas)
    window.ShowAndRun()
}

func createWindow(c fc.Canvas) fyne.Window {
    w := c.Window
    w.Resize(fyne.NewSize(float32(c.Width), float32(c.Height)))
    w.SetFixedSize(true)
    w.SetPadded(false)
    w.SetContent(c.Container)

    return w
}

@MatejMagat305
Copy link

I would like to ask you like fyne-io/fyne#2924, do you plan or would you allow me make some modifications to make "only" CanvasObject to integrate to fyne?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants