How to clear tk2text box in R tcltk2, tcltk

84 Views Asked by At

I am trying to clear the content of a text box which i created using

Window_1$env$txt1 <- tk2text(Window_1, width = 90, height = 1)

I can update the values using

tkinsert(Window_1$env$txt1 "end", "test")

But can someone help me how to clear the contents of Window_1$env$txt1

Cheers :)

1

There are 1 best solutions below

0
On

I found the answer :) to delete the text box I have to use tkdelete

tktag.add(Window_1$env$txt1, "sel", "0.0", "end") #tagging the selecting
tkdelete(Window_1$env$txt1, "sel.first", "sel.last")
tkinsert(Window_1$env$txt1, "end", "new_text")