8
4
Inspired by The Most Useless Machine Ever.
Write the shortest program that does the following:
- create a graphical window, then immediately close the window and exit the program.
- do this in some visually apparent manner. Like the "arm" that pushes the switch in the machine, the program must use some visual method in the GUI to close itself.
- this visual method must be what causes the program to close; you cannot just show it as something on the side (though there may be other things off to the side)
Note:
- The program does not have to be visible long enough for the visible activity to be seen by a human as long as the activity is the cause of the closing.
- The window must be a GUI (must display a graphical window that contains the visible exit method).
- The visual method needs to be something the user could do if it wasn't done automatically. Explain what needs to be changed in the code for the user to be able to do this (Thanks to Iszi).
- The program must close if there is no interference from the user, but if the user interferes, then it does not need to close automatically.
- Please include an explanation of what it is that causes the program to close.
Example: a window containing a button which is programmatically clicked, running a short snippet of code that closes the program.
2I'd suggest that, for programs not visible enough to be seen by a human, answers should include mention of what should be changed in the code (adding/increasing timer values, etc. - but not fundamentally changing its functionality) in order to demonstrate to a human that it actually does something visual. – Iszi – 2013-12-09T16:37:45.940
1I'm curious why this question is being DVd and VTCd. For one, this has an objective winning criterion; it's a [code-golf]. I can understand that this isn't the best question, but why is it being VTCd? – Justin – 2017-10-19T18:19:28.053
1Should this be code golf or a popularity contest? – Kevin – 2014-03-30T22:56:43.363
1I've changed my TI-BASIC answer to a compiled version that is shorter than my other answer (which is currently accepted). I'd appreciate it if you could change that :) – Timtech – 2014-04-02T13:30:07.577