__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
<!DOCTYPE html>
<html lang="es" dir="ltr">
<head>
<base href="../../../../">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Python: entrada y salida de y hacia la pantalla</title>
<link rel="shortcut icon" href="media/navigation/favicon.ico">
<link type="text/css" href="normalize.css" rel="Stylesheet">
<link type="text/css" href="prism.css" rel="Stylesheet">
<link type="text/css" href="default.css" rel="Stylesheet">
<script type="text/javascript" src="polyfills.js"></script><script type="text/javascript" src="languages.js"></script><script type="text/javascript" src="es/langnames.js"></script><script type="text/javascript" src="flexsearch.debug.js"></script><script type="text/javascript" src="prism.js"></script><script type="text/javascript" src="help2.js" defer></script><script type="text/javascript" src="a11y-toggle.js" defer></script><script type="text/javascript" src="paginathing.js" defer></script><script type="text/javascript" src="es/bookmarks.js" defer></script><script type="text/javascript" src="es/contents.js" defer></script><script type="text/javascript" src="help.js" defer></script><meta name="viewport" content="width=device-width,initial-scale=1">
</head>
<body>
<header id="TopLeftHeader"><a class="symbol" href="es/text/shared/05/new_help.html"><div></div></a><a class="logo" href="es/text/shared/05/new_help.html"><p dir="auto">Ayuda de LibreOffice 25.2</p></a><div class="dropdowns"><div class="modules">
<button type="button" data-a11y-toggle="modules-nav" id="modules" aria-haspopup="true" aria-expanded="false" aria-controls="modules-nav">Módulo</button><nav id="modules-nav" hidden=""></nav>
</div></div></header><aside class="leftside"><input id="accordion-1" name="accordion-menu" type="checkbox"><label for="accordion-1" dir="auto">Contenido</label><div id="Contents" class="contents-treeview"></div></aside><div id="SearchFrame"><div id="Bookmarks">
<input id="search-bar" type="search" class="search" placeholder="Buscar en los marcadores del módulo elegido" dir="auto"><div class="nav-container" tabindex="0"><nav class="index" dir="auto"></nav></div>
</div></div>
<div id="DisplayArea" itemprop="softwareHelp" itemscope="true" itemtype="http://schema.org/SoftwareApplication">
<noscript><div id="WarnJS"><h1 dir="auto">Active JavaScript en el navegador para mostrar las páginas de ayuda de LibreOffice.</h1></div></noscript>
    <a id="N0433"></a>        <meta itemprop="keywords" content="Python,InputBox">        <meta itemprop="keywords" content="Python,MsgBox">        <meta itemprop="keywords" content="Python,Print">        <meta itemprop="keywords" content="API,script.provider.MasterScriptProvider: Screen Input/Output">        <meta itemprop="keywords" content="API,script.provider.XScript: Screen Input/Output">
    <h1 id="N0434" dir="auto">
<a id="ioscreen"></a>Entrada y salida de y hacia la pantalla</h1>
    <p id="N0435" class="paragraph" dir="auto">La salida estándar de Python no está disponible cuando se ejecutan las macros Python desde el menú <span class="menuitem">Herramientas ▸ Macros ▸ Ejecutar macro</span>. Presentar la salida de un módulo requiere la consola interactiva de Python. Las funciones como <span class="literal">input()</span>, <span class="literal">print()</span>, <span class="literal">repr()</span> y <span class="literal">str()</span> están disponibles desde la consola de Python.</p>
    <div class="tip">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/tip.svg" alt="tip" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="msgbox_tip" dir="auto">LibreOffice <span class="literal">msgbox</span> Python module proposes a <span class="literal">msgbox()</span> method that is illustrated in <a target="_top" href="es/text/sbasic/python/python_handler.html">Creating Event Listeners</a> and <a target="_top" href="es/text/sbasic/python/python_handler.html">Creating a dialog handler</a> example pages.</p></div>
</div>
<br>
    <p id="N0437" class="paragraph" dir="auto">LibreOffice Basic propone las funciones de E/S de pantalla <span class="literal">InputBox()</span>, <span class="literal">Msgbox()</span> y <span class="literal">Print()</span>. Existen alternativas de Python que se basan en el kit de herramientas de ventanas abstractas de la API de LibreOffice, o bien en las llamadas de funciones de Python a Basic. Esta última alternativa propone una sintaxis que es intencionalmente cercana a la de Basic y utiliza un módulo de Python junto con un módulo de Basic. El marco de programación de macros de la API se utiliza para realizar llamadas de funciones entre los lenguajes Basic, BeanShell, JavaScript y Python.</p>
    <h2 id="N0438" dir="auto">Sintaxis de Python:</h2>
    <p id="N0439" class="code" dir="auto">MsgBox(txt, buttons=0, title=None)<br></p>
    <p id="N0440" class="code" dir="auto">InputBox(txt, title=None, default=None)<br></p>
    <p id="N0441" class="code" dir="auto">Print(txt)</p>
    <h2 id="N0442" dir="auto">Ejemplos:</h2>
    <p id="N0443" class="paragraph" dir="auto"><span class="literal">&gt;&gt;&gt; import screen_io as ui</span></p>
    <p id="N0445" class="paragraph" dir="auto"><span class="literal">&gt;&gt;&gt; reply = ui.InputBox('Please enter a phrase', title='Dear user', defaultValue="here..")</span></p>
    <p id="N0446" class="paragraph" dir="auto"><span class="literal">&gt;&gt;&gt; rc = ui.MsgBox(reply, title="Confirmation of phrase")</span></p>
    <p id="N0447" class="paragraph" dir="auto"><span class="literal">&gt;&gt;&gt; age = ui.InputBox('How old are you?', title="Hi")</span></p>
    <p id="N0448" class="paragraph" dir="auto"><span class="literal">&gt;&gt;&gt; ui.Print(age)</span></p>
    <h2 id="N0449" dir="auto">Instalación:</h2>
    <ul itemprop="Unordered" itemscope="true" itemtype="http://schema.org/ItemList" dir="auto">
        <li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto">
            <p id="N0450" class="listitem" dir="auto">Copy <span class="literal">screen_io</span> Python module in <a target="_top" href="es/text/sbasic/python/python_locations.html">My macros</a> within &lt;UserProfile&gt;/Scripts/python/pythonpath,</p>
        </li>
        <li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto">
            <p id="N0451" class="listitem" dir="auto">Copy <span class="literal">uiScripts</span> Basic module in <a target="_top" href="es/text/sbasic/python/python_locations.html">My macros</a> Standard Basic library,</p>
        </li>
        <li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto">
            <p id="N0452" class="listitem" dir="auto">Reinicie LibreOffice.</p>
        </li>
    </ul>
    <h3 id="N0453" dir="auto">Módulo <span class="literal">screen_io</span> de Python</h3>
    <div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-python line-numbers">
        # -*- coding: utf-8 -*-
        from __future__ import unicode_literals
        
        def MsgBox(prompt: str, buttons=0, title='LibreOffice') -&gt; int:
            """ Muestra un cuadro de diálogo que contiene un mensaje y devuelve un valor."""
            xScript = _getScript("_MsgBox")
            res = xScript.invoke((prompt,buttons,title), (), ())
            return res[0]
        
        def InputBox(prompt: str, title='LibreOffice', defaultValue='') -&gt; str:
            """ Displays a prompt in a dialog box at which the user can enter text."""
            xScript = _getScript("_InputBox")
            res = xScript.invoke((prompt,title,defaultValue), (), ())
            return res[0]
        
        def Print(message: str):
            """Outputs the specified strings or numeric expressions in a dialog box."""
            xScript = _getScript("_Print")
            xScript.invoke((message,), (), ())
        
        import uno
        from com.sun.star.script.provider import XScript
        def _getScript(script: str, library='Standard', module='uiScripts') -&gt; XScript:
            sm = uno.getComponentContext().ServiceManager
            mspf = sm.createInstanceWithContext("com.sun.star.script.provider.MasterScriptProviderFactory", uno.getComponentContext())
            scriptPro = mspf.createScriptProvider("")
            scriptName = "vnd.sun.star.script:"+library+"."+module+"."+script+"?language=Basic&amp;location=application"
            xScript = scriptPro.getScript(scriptName)
            return xScript
    </code></pre></div>
    <div class="note">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/note.svg" alt="note" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="par_id161655364816553" dir="auto"><span class="literal">MsgBox</span> and <span class="literal">InputBox</span> methods from the <a target="_top" href="es/text/sbasic/shared/03/sf_basic.html">Basic service</a> included in <a target="_top" href="es/text/sbasic/shared/03/lib_ScriptForge.html"> the ScriptForge libraries</a> call directly their native Basic counterparts.</p></div>
</div>
<br>
    <h3 id="N0492" dir="auto">Módulo <span class="literal">uiScripts</span> de Basic</h3>
    <div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
        Option Explicit
        Private Function _MsgBox( prompt As String, Optional buttons As Integer, _
                Optional title As String ) As Integer
            _MsgBox = MsgBox( prompt, buttons, title )
        End Function
        Private Function _InputBox( prompt As String, Optional title As String, _
                Optional default As String) As String
            _InputBox = InputBox( prompt, title, default )
        End Function
        Private Sub _Print( msg As String )
            Print msg
        End Sub
    </code></pre></div>
    <div class="tip">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/tip.svg" alt="tip" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="tip_APSO" dir="auto">The <a target="_blank" href="https://extensions.libreoffice.org/extensions/apso-alternative-script-organizer-for-python">Alternative Python Script Organizer</a> (APSO) extension offers a msgbox() function out of its <span class="literal">apso_utils</span> module.</p></div>
</div>
<br>
    <a id="relatedtopics"></a><div class="relatedtopics">
<p class="related" itemprop="mentions" dir="auto"><a id="related"></a><span class="emph">Temas relacionados</span></p>
<div class="relatedbody" itemprop="mentions">
        <div class="embedded"><p class="embedded" dir="auto"><a target="_top" href="es/text/sbasic/shared/03010000.html">Funciones de E/S de pantalla</a></p></div>
        <div class="embedded"><p class="embedded" dir="auto"><a target="_top" href="es/text/sbasic/python/python_examples.html">Ejemplos de programación en Python</a></p></div>
        <div class="embedded"><p class="embedded" dir="auto"><a target="_top" href="es/text/sbasic/python/main0000.html">Ayuda con las macros en Python en LibreOffice</a></p></div>
        <div class="embedded"><p class="embedded" dir="auto"><a target="_top" href="es/text/sbasic/python/python_2_basic.html">Llamar macros en Basic desde Python</a></p></div>
    </div>
</div>
</div>
<div id="DonationFrame"></div>
<footer><h2 style="text-align: center;"><a href="https://books.libreoffice.org" target="_blank">Libros de LibreOffice</a></h2>
<div class="noteicon" dir="auto" style="display:flex;justify-content:center;flex-wrap:wrap;row-gap:15px;">
<img src="media/navigation/libo-writer.svg" alt="Writer Icon" style="width:60px;height:60px;"><img src="media/navigation/libo-calc.svg" alt="Calc Icon" style="width:60px;height:60px;"><img src="media/navigation/libo-impress.svg" alt="Impress Icon" style="width:60px;height:60px;"><img src="media/navigation/libo-draw.svg" alt="Draw Icon" style="width:60px;height:60px;"><img src="media/navigation/libo-base.svg" alt="Base Icon" style="width:60px;height:60px;"><img src="media/navigation/libo-math.svg" alt="Math Icon" style="width:60px;height:60px;"><img src="media/navigation/libo-symbol-black.svg" alt="Getting Started Icon" style="width:60px;height:60px;">
</div>
<div id="DEBUG" class="debug">
<h3 class="bug">Help content debug info:</h3>
<p dir="auto">This page is: <a href="https://opengrok.libreoffice.org/xref/help/source/text/sbasic/python/python_screen.xhp" target="_blank">/text/sbasic/python/python_screen.xhp</a></p>
<p dir="auto">Title is: Python: entrada y salida de y hacia la pantalla</p>
<p id="bm_module" dir="auto"></p>
<p id="bm_system" dir="auto"></p>
<p id="bm_HID" dir="auto"></p>
</div></footer>
</body>
</html>

Filemanager

Name Type Size Permission Actions
main0000.html File 9.78 KB 0644
python_2_basic.html File 16.96 KB 0644
python_dialogs.html File 8.53 KB 0644
python_document_events.html File 25.83 KB 0644
python_examples.html File 6.89 KB 0644
python_handler.html File 17.02 KB 0644
python_ide.html File 6.29 KB 0644
python_import.html File 13.13 KB 0644
python_listener.html File 13.14 KB 0644
python_locations.html File 10.53 KB 0644
python_platform.html File 11.23 KB 0644
python_programming.html File 23.74 KB 0644
python_screen.html File 12.79 KB 0644
python_session.html File 13.14 KB 0644
python_shell.html File 12 KB 0644
Filemanager