You can make it invisible and remove from the layout. This does not actually remove it, but dynamically changes the interface:
import Graphics.UI.WX
buildGUI = do
f <- frame [ text := "Hello" ]
controls <- panel f []
ctext <- staticText controls [ text := "Foo" ]
butn <- button controls [text := "Remove the Foo"]
set controls [ layout := row 0 [margin 5 (widget ctext),
margin 5 (widget butn) ]]
set f [ layout := widget controls ]
set butn [on command := do
set ctext [visible := False]
set controls [layout := margin 5 (widget butn) ]]
return ()
main = start buildGUI
source
share