.. wxPython Phoenix documentation This file was generated by Phoenix's sphinx generator and associated tools, do not edit by hand. Copyright: (c) 2011-2017 by Total Control Software License: wxWindows License .. include:: headings.inc .. currentmodule:: wx.py.shell .. highlight:: python .. _wx.py.shell.Shell: ========================================================================================================================================== |phoenix_title| **wx.py.shell.Shell** ========================================================================================================================================== Shell based on StyledTextCtrl. | |class_hierarchy| Class Hierarchy ================================= .. raw:: html
Inheritance diagram for class Shell:

| |super_classes| Known Superclasses ================================== :class:`wx.py.editwindow.EditWindow` | |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~wx.py.shell.Shell.__init__` Create Shell instance. :meth:`~wx.py.shell.Shell.about` Display information about Py. :meth:`~wx.py.shell.Shell.addHistory` Add command to the command history. :meth:`~wx.py.shell.Shell.ask` Get response from the user using a dialog box. :meth:`~wx.py.shell.Shell.autoCallTipShow` Display argument spec and docstring in a popup window. :meth:`~wx.py.shell.Shell.autoCompleteShow` Display auto-completion popup list. :meth:`~wx.py.shell.Shell.CanCut` Return true if text is selected and can be cut. :meth:`~wx.py.shell.Shell.CanEdit` Return true if editing should succeed. :meth:`~wx.py.shell.Shell.CanPaste` Return true if a paste should succeed. :meth:`~wx.py.shell.Shell.clear` Delete all text from the shell. :meth:`~wx.py.shell.Shell.clearCommand` Delete the current, unexecuted command. :meth:`~wx.py.shell.Shell.clearHistory` :meth:`~wx.py.shell.Shell.Copy` Copy selection and place it on the clipboard. :meth:`~wx.py.shell.Shell.CopyWithPrompts` Copy selection, including prompts, and place it on the clipboard. :meth:`~wx.py.shell.Shell.CopyWithPromptsPrefixed` Copy selection, including prompts prefixed with four :meth:`~wx.py.shell.Shell.Cut` Remove selection and place it on the clipboard. :meth:`~wx.py.shell.Shell.destroy` :meth:`~wx.py.shell.Shell.execStartupScript` Execute the user's PYTHONSTARTUP script if they have one. :meth:`~wx.py.shell.Shell.Execute` Replace selection with text and run commands. :meth:`~wx.py.shell.Shell.fixLineEndings` Return text with line endings replaced by OS-specific endings. :meth:`~wx.py.shell.Shell.getCommand` Extract a command from text which may include a shell prompt. :meth:`~wx.py.shell.Shell.GetContextMenu` Create and return a context menu for the shell. :meth:`~wx.py.shell.Shell.getMultilineCommand` Extract a multi-line command from the editor. :meth:`~wx.py.shell.Shell.insertLineBreak` Insert a new line break. :meth:`~wx.py.shell.Shell.LoadSettings` :meth:`~wx.py.shell.Shell.lstripPrompt` Return text without a leading prompt. :meth:`~wx.py.shell.Shell.OnCallTipAutoCompleteManually` AutoComplete and Calltips manually. :meth:`~wx.py.shell.Shell.OnChar` Keypress event handler. :meth:`~wx.py.shell.Shell.OnContextMenu` :meth:`~wx.py.shell.Shell.OnHistoryInsert` Insert the previous/next command from the history buffer. :meth:`~wx.py.shell.Shell.OnHistoryReplace` Replace with the previous/next command from the history buffer. :meth:`~wx.py.shell.Shell.OnHistorySearch` Search up the history buffer for the text in front of the cursor. :meth:`~wx.py.shell.Shell.OnIdle` Free the CPU to do other things. :meth:`~wx.py.shell.Shell.OnKeyDown` Key down event handler. :meth:`~wx.py.shell.Shell.OnShowCompHistory` Show possible autocompletion Words from already typed words. :meth:`~wx.py.shell.Shell.OnUpdateUI` :meth:`~wx.py.shell.Shell.Paste` Replace selection with clipboard contents. :meth:`~wx.py.shell.Shell.PasteAndRun` Replace selection with clipboard contents, run commands. :meth:`~wx.py.shell.Shell.pause` Halt execution pending a response from the user. :meth:`~wx.py.shell.Shell.processLine` Process the line of text at which the user hit Enter. :meth:`~wx.py.shell.Shell.prompt` Display proper prompt for the context: ps1, ps2 or ps3. :meth:`~wx.py.shell.Shell.push` Send command to the interpreter for execution. :meth:`~wx.py.shell.Shell.quit` Quit the application. :meth:`~wx.py.shell.Shell.raw_input` Return string based on user input. :meth:`~wx.py.shell.Shell.readline` Replacement for stdin.readline(). :meth:`~wx.py.shell.Shell.readlines` Replacement for stdin.readlines(). :meth:`~wx.py.shell.Shell.redirectStderr` If redirect is true then sys.stderr will go to the shell. :meth:`~wx.py.shell.Shell.redirectStdin` If redirect is true then sys.stdin will come from the shell. :meth:`~wx.py.shell.Shell.redirectStdout` If redirect is true then sys.stdout will go to the shell. :meth:`~wx.py.shell.Shell.replaceFromHistory` Replace selection with command from the history buffer. :meth:`~wx.py.shell.Shell.run` Execute command as if it was typed in directly. :meth:`~wx.py.shell.Shell.runfile` Execute all commands in file as if they were typed into the :meth:`~wx.py.shell.Shell.SaveSettings` :meth:`~wx.py.shell.Shell.setBuiltinKeywords` Create pseudo keywords as part of builtins. :meth:`~wx.py.shell.Shell.setFocus` Set focus to the shell. :meth:`~wx.py.shell.Shell.setLocalShell` Add 'shell' to locals as reference to ShellFacade instance. :meth:`~wx.py.shell.Shell.setStatusText` Display status information. :meth:`~wx.py.shell.Shell.showIntro` Display introductory text in the shell. :meth:`~wx.py.shell.Shell.wrap` Sets whether text is word wrapped. :meth:`~wx.py.shell.Shell.write` Display text in the shell. :meth:`~wx.py.shell.Shell.writeErr` Replacement for stderr. :meth:`~wx.py.shell.Shell.writeOut` Replacement for stdout. :meth:`~wx.py.shell.Shell.zoom` Set the zoom level. ================================================================================ ================================================================================ | |api| Class API =============== .. class:: Shell(editwindow.EditWindow) Shell based on StyledTextCtrl. .. method:: __init__(self, parent, id=-1, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.CLIP_CHILDREN, introText='', locals=None, InterpClass=None, startupScript=None, execStartupScript=True, \*args, \*\*kwds) Create Shell instance. .. method:: about(self) Display information about Py. .. method:: addHistory(self, command) Add command to the command history. .. method:: ask(self, prompt='Please enter your response:') Get response from the user using a dialog box. .. method:: autoCallTipShow(self, command, insertcalltip = True, forceCallTip = False) Display argument spec and docstring in a popup window. .. method:: autoCompleteShow(self, command, offset = 0) Display auto-completion popup list. .. method:: CanCut(self) Return true if text is selected and can be cut. .. method:: CanEdit(self) Return true if editing should succeed. .. method:: CanPaste(self) Return true if a paste should succeed. .. method:: clear(self) Delete all text from the shell. .. method:: clearCommand(self) Delete the current, unexecuted command. .. method:: clearHistory(self) .. method:: Copy(self) Copy selection and place it on the clipboard. .. method:: CopyWithPrompts(self) Copy selection, including prompts, and place it on the clipboard. .. method:: CopyWithPromptsPrefixed(self) Copy selection, including prompts prefixed with four spaces, and place it on the clipboard. .. method:: Cut(self) Remove selection and place it on the clipboard. .. method:: destroy(self) .. method:: execStartupScript(self, startupScript) Execute the user's PYTHONSTARTUP script if they have one. .. method:: Execute(self, text) Replace selection with text and run commands. .. method:: fixLineEndings(self, text) Return text with line endings replaced by OS-specific endings. .. method:: getCommand(self, text=None, rstrip=True) Extract a command from text which may include a shell prompt. The command may not necessarily be valid Python syntax. .. method:: GetContextMenu(self) Create and return a context menu for the shell. This is used instead of the scintilla default menu in order to correctly respect our immutable buffer. .. method:: getMultilineCommand(self, rstrip=True) Extract a multi-line command from the editor. The command may not necessarily be valid Python syntax. .. method:: insertLineBreak(self) Insert a new line break. .. method:: LoadSettings(self, config) .. method:: lstripPrompt(self, text) Return text without a leading prompt. .. method:: OnCallTipAutoCompleteManually (self, shiftDown) AutoComplete and Calltips manually. .. method:: OnChar(self, event) Keypress event handler. Only receives an event if OnKeyDown calls event.Skip() for the corresponding event. .. method:: OnContextMenu(self, evt) .. method:: OnHistoryInsert(self, step) Insert the previous/next command from the history buffer. .. method:: OnHistoryReplace(self, step) Replace with the previous/next command from the history buffer. .. method:: OnHistorySearch(self) Search up the history buffer for the text in front of the cursor. .. method:: OnIdle(self, event) Free the CPU to do other things. .. method:: OnKeyDown(self, event) Key down event handler. .. method:: OnShowCompHistory(self) Show possible autocompletion Words from already typed words. .. method:: OnUpdateUI(self, evt) .. method:: Paste(self) Replace selection with clipboard contents. .. method:: PasteAndRun(self) Replace selection with clipboard contents, run commands. .. method:: pause(self) Halt execution pending a response from the user. .. method:: processLine(self) Process the line of text at which the user hit Enter. .. method:: prompt(self) Display proper prompt for the context: ps1, ps2 or ps3. If this is a continuation line, autoindent as necessary. .. method:: push(self, command, silent = False) Send command to the interpreter for execution. .. method:: quit(self) Quit the application. .. method:: raw_input(self, prompt='') Return string based on user input. .. method:: readline(self) Replacement for stdin.readline(). .. method:: readlines(self) Replacement for stdin.readlines(). .. method:: redirectStderr(self, redirect=True) If redirect is true then sys.stderr will go to the shell. .. method:: redirectStdin(self, redirect=True) If redirect is true then sys.stdin will come from the shell. .. method:: redirectStdout(self, redirect=True) If redirect is true then sys.stdout will go to the shell. .. method:: replaceFromHistory(self, step) Replace selection with command from the history buffer. .. method:: run(self, command, prompt=True, verbose=True) Execute command as if it was typed in directly. >>> shell.run('print("this")') >>> print("this") this >>> .. method:: runfile(self, filename) Execute all commands in file as if they were typed into the shell. .. method:: SaveSettings(self, config) .. method:: setBuiltinKeywords(self) Create pseudo keywords as part of builtins. This sets "close", "exit" and "quit" to a helpful string. .. method:: setFocus(self) Set focus to the shell. .. method:: setLocalShell(self) Add 'shell' to locals as reference to ShellFacade instance. .. method:: setStatusText(self, text) Display status information. .. method:: showIntro(self, text='') Display introductory text in the shell. .. method:: wrap(self, wrap=True) Sets whether text is word wrapped. .. method:: write(self, text) Display text in the shell. Replace line endings with OS-specific endings. .. method:: writeErr(self, text) Replacement for stderr. .. method:: writeOut(self, text) Replacement for stdout. .. method:: zoom(self, points=0) Set the zoom level. This number of points is added to the size of all fonts. It may be positive to magnify or negative to reduce.