Remove object from GUI

Hello, I tried to find the answer to this question on previous threads, but there are no related questions.
Let’s suppose that I make a window
And let’s suppose that I make an object, like button, that is shown in w: ~mybutton = Button(w).

What’s the correct way/function to remove ~mybutton from w (for example, as an action triggered by some other object)?

~mybutton.remove will do the trick.

if you want to manipulate a GUI object from a scheduled function like ex Task or .fork you need to defer it like this: { {~mybutton.remove}.defer; }.fork;

1 Like