Translation

python_2_basic.xhp N0378 help.text
English F8dF9
Context English sid (generated) Actions
python_2_basic.xhp
N0338
help.text
When running Python scripts from an Integrated Development Environment (IDE), the %PRODUCTNAME-embedded Basic engine may be absent. Avoid Python-to-%PRODUCTNAME Basic calls in such contexts. However Python environment and Universal Networks Objects (UNO) are fully available. Refer to <link href="text/sbasic/python/python_ide.xhp">Setting Up an Integrated IDE for Python</link> for more information.
python_2_basic.xhp
N0339
help.text
Retrieving %PRODUCTNAME Basic Scripts
python_2_basic.xhp
N0340
help.text
%PRODUCTNAME Basic macros can be personal, shared, or embedded in documents. In order to execute them, Python run time needs to be provided with Basic macro locations. Implementing the <link href="https://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1script_1_1provider_1_1XScript.html">com.sun.star.script.provider.XScriptProvider</link> interface allows the retrieval of executable scripts:
python_2_basic.xhp
N0341
help.text
<bookmark_value>API;script.provider.MasterScriptProviderFactory: Retrieving Basic scripts</bookmark_value><bookmark_value>API;script.provider.XScript: Executing Basic scripts</bookmark_value><bookmark_value>API;XScriptProvider: Retrieving Basic scripts</bookmark_value>
python_2_basic.xhp
N0347
help.text
'''Grab Basic script object before invocation.'''
python_2_basic.xhp
N0363
help.text
Executing %PRODUCTNAME Basic Scripts
python_2_basic.xhp
N0364ndx
help.text
<bookmark_value>API;script.provider.XScript : Executing Basic scripts</bookmark_value>
python_2_basic.xhp
N0364
help.text
The %PRODUCTNAME Software Development Kit (SDK) documentation for <link href="https://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1script_1_1provider_1_1XScript.html#a11a551f5a2520f74c5109cd8c9f8c7b7">com.sun.star.script.provider.XScript</link> interface details the calling convention for inter-language calls. Invocation of functions requires three arrays:
python_2_basic.xhp
N0365
help.text
the first lists the arguments of the called routine
python_2_basic.xhp
N0366
help.text
the second identifies modified arguments
python_2_basic.xhp
N0367
help.text
the third stores the return values
python_2_basic.xhp
N0368
help.text
Python Syntax
python_2_basic.xhp
N0372
help.text
Examples of Personal or Shared Scripts
python_2_basic.xhp
N0373
help.text
Examples in <link href="text/sbasic/python/python_screen.xhp">Input/Output to Screen</link> detail Python to Basic invocation calls. <link href="text/sbasic/python/python_document_events.xhp">Monitoring Document Events</link> illustrates the usage of *args Python idiom to print a variable number of parameters to <literal>Access2Base</literal> logging console dialog.
python_2_basic.xhp
N0374
help.text
At time of development you can interrupt Python script execution using <link href="https://berma.pagesperso-orange.fr/index2.html">Xray extension</link> in order to inspect properties and methods of UNO objects. The APSO extension debugger allows object introspection using either Xray either MRI extensions.
python_2_basic.xhp
N0378
help.text
Examples of Embedded Scripts in Documents
python_2_basic.xhp
N0379
help.text
<literal>*args</literal>Python simplified syntax can be used in conjunction with %PRODUCTNAME Basic routines that accept a variable number of arguments. Below <literal>Print</literal> and <literal>SUM</literal> Python functions call their Basic <literal>Print</literal> and <literal>SUM</literal> counterparts, using aforementioned <literal>getBasicScript</literal> function. Exception handling is not detailed.
python_2_basic.xhp
N0384
help.text
"""Outputs the specified strings or numeric expressions in a dialog box."""
python_2_basic.xhp
N0389
help.text
"""SUM the specified number expression."""
python_2_basic.xhp
N0402
help.text
The %PRODUCTNAME Basic <literal>Print</literal> and <literal>SUM</literal> document-based routines accept a variable number of arguments. The <literal>Private</literal> or <literal>Public</literal> attributes have no effect. The arguments type checking is skipped for clarity.
python_2_basic.xhp
N0407
help.text
''' Print item list of variable number '''
python_2_basic.xhp
N0408
help.text
' all CStr() convertible args are accepted
python_2_basic.xhp
N0419
help.text
''' SUM a variable list of numbers '''
python_dialogs.xhp
tit
help.text
Opening a Dialog with Python
python_dialogs.xhp
N0334
help.text
<bookmark_value>Python;dialogs</bookmark_value> <bookmark_value>dialog box;Python</bookmark_value> <bookmark_value>dialogs;Python</bookmark_value>
python_dialogs.xhp
N0336
help.text
<variable id="pythondialog"><link href="text/sbasic/python/python_dialogs.xhp">Opening a Dialog with Python</link></variable>
python_dialogs.xhp
N0337
help.text
%PRODUCTNAME static dialogs are created with the <link href="text/sbasic/guide/create_dialog.xhp">Dialog editor</link> and are stored in varying places according to their personal (My Macros), shared (Application Macros) or document-embedded nature. In reverse, dynamic dialogs are constructed at runtime, from Basic or Python scripts, or using any other <link href="text/shared/guide/scripting.xhp">%PRODUCTNAME supported language</link> for that matter. Opening static dialogs with Python is illustrated herewith. Exception handling and internationalization are omitted for clarity.
python_dialogs.xhp
N0338
help.text
My Macros or Application Macros dialogs
python_dialogs.xhp
N0339
help.text
The examples below open <literal>Access2Base Trace</literal> console or the imported <literal>TutorialsDialog</literal> dialog with <menuitem>Tools - Macros - Run Macro</menuitem> menu:
python_dialogs.xhp
N0364
help.text
Document embedded dialogs
python_dialogs.xhp
N0365
help.text
The example below opens a newly edited <literal>Dialog1</literal> dialog from a document with <menuitem>Tools - Macros - Run Macro</menuitem> menu:

Loading…

No matching activity found.
Browse all component changes

Glossary

English sid (generated)
No related strings found in the glossary.

String information

Context
python_2_basic.xhp
N0378
help.text
Source string description
F8dF9
Source string location
python_2_basic.xhp
String age
3 years ago
Source string age
3 years ago
Translation file
sid/helpcontent2/source/text/sbasic/python.po, string 37