Context English Central Khmer
main0000.xhp
tit
help.text
Python Scripts
main0000.xhp
bm_id491543348147708
help.text
<bookmark_value>macros;Python scripts</bookmark_value> <bookmark_value>Python;macros</bookmark_value> <bookmark_value>scripts;Python</bookmark_value>
main0000.xhp
hd_id3154232
help.text
<variable id="pythonscriptshelp"><link href="text/sbasic/python/main0000.xhp" name="mainpython">%PRODUCTNAME Python Scripts Help</link></variable>
main0000.xhp
par_id3153894
help.text
%PRODUCTNAME provides an Application Programming Interface (API) that allows controlling the $[officename] components with different programming languages by using the $[officename] Software Development Kit (SDK). For more information about the $[officename] API and the Software Development Kit, visit <link href="https://api.libreoffice.org/" name="api.libreoffice.org">https://api.libreoffice.org</link>
main0000.xhp
par_id3147226
help.text
This help section explains the most common Python script functions for %PRODUCTNAME. For more in-depth information please refer to the <link href="https://wiki.documentfoundation.org/Macros/Python_Design_Guide" name="wiki.documentfoundation.org PYTHON Guide">Designing & Developing Python Applications</link> on the Wiki.
main0000.xhp
hd_id3146957
help.text
Working with Python Scripts in %PRODUCTNAME
main0000.xhp
N0102
help.text
You can execute Python scripts choosing <menuitem>Tools - Macros - Run Macro</menuitem>. Editing scripts can be done with your preferred text editor. Python scripts are present in various locations detailed hereafter. You can refer to Programming examples for macros illustrating how to run the Python interactive console from %PRODUCTNAME.
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" name="command_name">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" name="dialog editor">Dialog editor</link> and are stored in varying places according to their personal (My Macros), shared (%PRODUCTNAME 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 %PRODUCTNAME 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:
python_dialogs.xhp
N0370
help.text
""" Display a doc-based dialog """
python_dialogs.xhp
N0381
help.text
Refer to <literal>msgbox.py</literal> in <literal>{installation}/program/</literal> directory for Python dynamic dialog examples.
python_document_events.xhp
tit
help.text
Python : Monitoring Document Events
python_document_events.xhp
N0526
help.text
<bookmark_value>Basic;Monitoring Document Events</bookmark_value> <bookmark_value>Python;Monitoring Document Events</bookmark_value> <bookmark_value>Access2Base;Console</bookmark_value> <bookmark_value>Access2Base;Trace</bookmark_value> <bookmark_value>Tools;Strings</bookmark_value> <bookmark_value>API;BasicLibraries</bookmark_value> <bookmark_value>API;DocumentEvent</bookmark_value> <bookmark_value>API;DocumentEventListener</bookmark_value> <bookmark_value>API;EventObject</bookmark_value> <bookmark_value>API;GlobalEventBroadcaster</bookmark_value> <bookmark_value>API;MasterScriptProviderFactory</bookmark_value> <bookmark_value>API;XDocumentEventBroadcaster</bookmark_value> <bookmark_value>API;XDocumentEventListener</bookmark_value> <bookmark_value>API;XScript</bookmark_value>
python_document_events.xhp
N0527
help.text
<variable id="pythonmonitor"><link href="text/sbasic/python/python_document_events.xhp" name="Monitoring Document Events">Monitoring Document Events</link></variable>