Handler on explicitly closing the GUI window.
176031
def handler(self):
    """"""
    self.pauseMovie()
    if tkMessageBox.askokcancel("Quit?", "Are you sure you want to quit?"):
      self.exitClient()
    else: # When the user presses cancel, resume playing.
      #self.playMovie()
      print "Playing Movie"
      threading.Thread(target=self.listenRtp).start()
      #self.playEvent = threading.Event()
      #self.playEvent.clear()
      self.sendRtspRequest(self.PLAY)
1347913
def on_end_validation(self, event):
        
        self.Enable()
        self.Show()
        self.magic_gui_frame.Destroy()
1262985
public void closeWindow(boolean keepFrame) {

        if (m_window != null) {
            m_keepFrameOnClose = keepFrame;
            m_window.close();
            m_window = null;
        }
    }
192001
def close_window(self):
        """"""
        if self.undocked_window is not None:
            self.undocked_window.close()
            self.undocked_window = None

            # Oddly, these actions can appear disabled after the Dock
            # action is pressed
            self.undock_action.setDisabled(False)
            self.close_plugin_action.setDisabled(False)
944054
def close(self):
        ''''''
        self.close_window.release()
        count=0
        while self.child.is_alive() and count < 30: # 3 seconds to die...
            time.sleep(0.1) #?
            count+=1

        if self.child.is_alive():
            self.child.terminate()

        self.child.join()
383627
void exit() {

        if (m_changed) {
            CmsConfirmationDialog.show(
                CmsVaadinUtils.getMessageText(org.opencms.ui.apps.Messages.GUI_EDITOR_CLOSE_CAPTION_0),
                CmsVaadinUtils.getMessageText(org.opencms.ui.apps.Messages.GUI_EDITOR_CLOSE_TEXT_0),
                new Runnable() {

                    public void run() {

                        exitInternal();
                    }
                });
        } else {
            exitInternal();
        }

    }
482345
def _exit_handling(self):
        

        def close_asyncio_loop():
            loop = None
            try:
                loop = asyncio.get_event_loop()
            except AttributeError:
                pass
            if loop is not None:
                loop.close()

        atexit.register(close_asyncio_loop)
776605
def close_other_windows(self):
        
        main_window_handle = self.current_window_handle
        for window_handle in self.window_handles:
            if window_handle == main_window_handle:
                continue
            self.switch_to_window(window_handle)
            self.close()
        self.switch_to_window(main_window_handle)
350659
def close(*args, **kwargs):
    """
    _, plt, _ = _import_plt()
    plt.close(*args, **kwargs)
998762
public static void closeWindows(Window... ignoredWindows) {
        Window[] ws = Window.getWindows();
        for (Window w : ws) {
            if (!contains(ignoredWindows, w)) w.dispose();
        }
    }
1149734
protected function closeHandle()
    {
        $handle = $this->getHandle();
        fclose($handle);
        $this->_handle = false;

        $this->runCommand($this->getFileName());
    }
474226
def closeEvent(self, event):
        

        # Make it snappy, but take care to clean it all up.
        # TODO(marcus): Enable GUI to return on problem, such
        # as asking whether or not the user really wants to quit
        # given there are things currently running.
        self.hide()

        if self.data["state"]["is_closing"]:

            # Explicitly clear potentially referenced data
            self.info(self.tr("Cleaning up models.."))
            for v in self.data["views"].values():
                v.model().deleteLater()
                v.setModel(None)

            self.info(self.tr("Cleaning up terminal.."))
            for item in self.data["models"]["terminal"].items:
                del(item)

            self.info(self.tr("Cleaning up controller.."))
            self.controller.cleanup()

            self.info(self.tr("All clean!"))
            self.info(self.tr("Good bye"))
            return super(Window, self).closeEvent(event)

        self.info(self.tr("Closing.."))

        def on_problem():
            self.heads_up("Warning", "Had trouble closing down. "
                          "Please tell someone and try again.")
            self.show()

        if self.controller.is_running:
            self.info(self.tr("..as soon as processing is finished.."))
            self.controller.is_running = False
            self.finished.connect(self.close)
            util.defer(2000, on_problem)
            return event.ignore()

        self.data["state"]["is_closing"] = True

        util.defer(200, self.close)
        return event.ignore()
852930
def close(self):
        ''''''
        self.time_to_quit = True
        self.close_window.release()
        if self.child.is_alive():
            self.child.join(1)

        self.child.terminate()

        self.mavlink_message_queue_handler.join()

        self.event_queue_lock.acquire()
        self.event_queue.put(MissionEditorEvent(me_event.MEE_TIME_TO_QUIT));
        self.event_queue_lock.release()
399980
def quit(self, exit_code=0, event=None):
        

        # --- Running on_close components methods. ---
        for component in reversed(self.__components_manager.list_components()):
            interface = self.__components_manager.get_interface(component)
            if not interface:
                continue

            if not interface.activated:
                continue

            if not hasattr(interface, "on_close"):
                continue

            if not interface.on_close():
                event and event.ignore()
                return

        # Storing current layout.
        self.__layouts_manager.store_startup_layout()
        self.__settings.settings.sync()

        # Stopping worker threads.
        for worker_thread in self.__worker_threads:
            LOGGER.debug("> Stopping worker thread: '{0}'.".format(worker_thread))
            if not worker_thread.isFinished():
                worker_thread.quit()
            worker_thread.wait()

        foundations.verbose.remove_logging_handler(self.__logging_file_handler)
        foundations.verbose.remove_logging_handler(self.__logging_session_handler)
        # foundations.verbose.remove_logging_handler(self.__logging_console_handler)

        # Stopping the Application timer.
        self.__timer.stop()
        self.__timer = None

        self.deleteLater()
        event and event.accept()

        exit(exit_code)
1241643
void closedHandler(Object context, String input, Object frame, String stateName) {
        if (getReadyState() == ReadyState.CLOSED) {
            return;
        }
        
        // TODO: Determine whether channels need to be cleaned up.
        if (this.channels.size() != 0) {
            for (int i = 1; i <= this.channels.size(); i++) { // 1-based
                AmqpChannel channel = this.channels.get(i);
                AmqpFrame   f = new AmqpFrame();
                
                // Close each channel which should result in CLOSE event
                // to be fired for each of the registered ChannelListener(s).
                f.setMethodName("closeChannel");
                f.setChannelId((short) i);
                channel.channelClosedHandler(this, "", f, "closeChannel");
            }
        }
        
        try {
            // Mark the readyState to be CLOSED.
            readyState = ReadyState.CLOSED;
            
            // Fire CLOSE event for the ConnectionListener(s) registered
            // on AmqpClient object.
            fireOnClosed(new ConnectionEvent(this, Kind.CLOSE));

            // If the WebSocket(or ByteSocket) is still not closed, then 
            // invoke the close() method. The callback in this case will be a
            // a no-op as we have completed the book-keeping here.
            if (websocket != null) {
                websocket.close();
            }
        }
        catch (Exception e1) {
            throw new IllegalStateException(e1);
        }
        finally {
            websocket = null;
        }

    }
5482
def closeEvent(self, event):
        """"""
        if self.closing(True):
            event.accept()
        else:
            event.ignore()
23724
def close_window(self, window_name=None, title=None, url=None):
        
        main_window_handle = self.current_window_handle
        self.switch_to_window(window_name, title, url)
        self.close()
        self.switch_to_window(main_window_handle)