Home > database >  How to display text that can be copied on a fyne GUI?
How to display text that can be copied on a fyne GUI?

Time:01-08

On my fyne GUI, I want to display text that can be copied by the user. So far, I'm using a (multi-line) enter image description here

CodePudding user response:

Labels are for display only, they afford no user interaction - this is something that web based apps have confused us about :). In Fyne apps we aim to have all user interaction hinted at, buttons and links are interactive, text is not. There are two possible approaches:

  1. put a “copy” button next to your label as has become common practice in many apps (for example password managers or YouTube)
  2. use a disabled Entry so the text can be interacted with but not edited.

CodePudding user response:

To complement andy.xyz's answer, here's an example of how a button can be used to copy a certain content to the clipboard. Fyne windows have a https://pkg.go.dev/fyne.io/fyne#Clipboard

  •  Tags:  
  • Related