How to create a pop-up warning that the script has come to an end?

Asked

Viewed 132 times

7

I would like to display on screen one pop-up notifying that the code just ran.

The only script I have, follows below, is the one that opens a command window.

system('CMD /C "ECHO O seu script chegou ao fim! && PAUSE"', 
        invisible=FALSE, wait=FALSE)

2 answers

3

Another solution is to use the tcltk package. This package is already installed in R, although it does not appear in the CRAN package list.

require(tcltk)
tkmessageBox(title = 'Exemplo tcltk', message = 'Operação concluída!', type = 'ok')

As with the rpanel package, the session will be blocked. If you do not want to block, da para usar uma progressbar, do pacote utils.

 invisible(winProgressBar(title = "Concluido!", label = "Operação concluída!", initial = 1))

If the goal is to draw attention, you can also use the alarm() to make a sound.

  • That’s interesting! Who knew there was this feature in this base package! Thanks!

3


Well, your answer is a possibility.

Another and use the package ring. For this, Voce will need to have installed Tcl/Tk and the Bwidget package. Then, inside the R, knife:

install.packages("rpanel")

Now Voce can do something like:

rp.messagebox("Popup usando rpanel", title="Titulo criativo")

that on my pc will generate the following window:

Popup gerado pelo codigo acima

Detail that this popup will block the session.

  • Thank you very much, that’s what I needed!

  • Great :) You can mark the answer that you liked the most as 'accept', then :)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.