Dictionary Module Reference

New in version 0.0.2.

Control the macOS Dictionary application using JXA-like syntax.

Functions:

DCSCopyTextDefinition(arg0, arg1, arg2, /)

CFStringRef DCSCopyTextDefinition(DCSDictionaryRef arg0, CFStringRef arg1, CoreFoundation.CFRange arg2);

Classes:

XADictionaryApplication(properties)

A class for managing and interacting with Dictionary.app.

PyXA.apps.Dictionary.DCSCopyTextDefinition(arg0, arg1, arg2, /)

CFStringRef DCSCopyTextDefinition(DCSDictionaryRef arg0, CFStringRef arg1, CoreFoundation.CFRange arg2);

class PyXA.apps.Dictionary.XADictionaryApplication(properties)[source]

Bases: XAApplication

A class for managing and interacting with Dictionary.app.

See also

XADictionaryDefinition

New in version 0.0.2.

Methods:

define(word)

Gets the definition of a word in raw text form.

fullscreen()

Toggles fullscreen for the current Dictionary window.

go_back()

Goes to the previous page/definition.

go_forward()

Goes to the next page/definition.

new_tab()

Opens a new Dictionary tab.

new_window()

Opens a new Dictionary window.

open_about_panel()

Opens the "About Dictionary" panel.

open_dictionaries_folder()

Opens the folder containing custom/downloaded dictionaries.

open_preferences()

Opens the preferences window for the Dictionary application.

paste()

Pastes the current contents of the clipboard into the selected item, if there is one.

print()

Opens the dictionary app's print dialog.

search(term)

Searches the currently selected dictionary.

search_all(term)

Searches the provided term in all dictionaries

search_apple_dictionary(term)

Searches the provided term in the Apple Dictionary

search_new_oxford(term)

Searches the provided term in the New Oxford American Dictionary

search_oxford_thesaurus(term)

Searches the provided term in the Oxford American Writer's Thesaurus

search_wikipedia(term)

Searches the provided term in Wikipedia

show_help()

Displays the help window for Dictionary.app.

start_dictation()

Begins dictation to fill the selected item, if there is one.

switch_to_all()

Switches to searching all installed dictionaries.

switch_to_apple_dictionary()

Switches to searching the Apple Dictionary.

switch_to_new_oxford()

Switches to searching the New Oxford American Dictionary.

switch_to_oxford_thesaurus()

Switches to searching the Oxford American Writer's Thesaurus.

switch_to_wikipedia()

Switches to searching Wikipedia.

view_front_back_matter()

Displays the front/back matter of the selected dictionary.

define(word: str) str[source]

Gets the definition of a word in raw text form.

Parameters:

word (str) – The word to define

Returns:

The definition of the word

Return type:

str

New in version 0.0.2.

fullscreen()[source]

Toggles fullscreen for the current Dictionary window.

New in version 0.0.2.

go_back()[source]

Goes to the previous page/definition.

New in version 0.0.2.

go_forward()[source]

Goes to the next page/definition.

New in version 0.0.2.

new_tab()[source]

Opens a new Dictionary tab.

New in version 0.0.2.

new_window()[source]

Opens a new Dictionary window.

New in version 0.0.2.

open_about_panel()[source]

Opens the “About Dictionary” panel. Mimics clicking File->About Dictionary.

New in version 0.0.2.

open_dictionaries_folder()[source]

Opens the folder containing custom/downloaded dictionaries.

New in version 0.0.2.

open_preferences()[source]

Opens the preferences window for the Dictionary application. Mimics clicking File->Preferences…

New in version 0.0.2.

paste()[source]

Pastes the current contents of the clipboard into the selected item, if there is one.

New in version 0.0.2.

print()[source]

Opens the dictionary app’s print dialog.

New in version 0.0.2.

search(term: str)[source]

Searches the currently selected dictionary.

Parameters:

term (str) – The term to search

New in version 0.0.2.

search_all(term: str)[source]

Searches the provided term in all dictionaries

Parameters:

term (str) – The term to search

New in version 0.0.2.

search_apple_dictionary(term: str)[source]

Searches the provided term in the Apple Dictionary

Parameters:

term (str) – The term to search

New in version 0.0.2.

search_new_oxford(term: str)[source]

Searches the provided term in the New Oxford American Dictionary

Parameters:

term (str) – The term to search

New in version 0.0.2.

search_oxford_thesaurus(term: str)[source]

Searches the provided term in the Oxford American Writer’s Thesaurus

Parameters:

term (str) – The term to search

New in version 0.0.2.

search_wikipedia(term: str)[source]

Searches the provided term in Wikipedia

Parameters:

term (str) – The term to search

New in version 0.0.2.

show_help()[source]

Displays the help window for Dictionary.app.

New in version 0.0.2.

start_dictation()[source]

Begins dictation to fill the selected item, if there is one.

New in version 0.0.2.

switch_to_all()[source]

Switches to searching all installed dictionaries.

New in version 0.0.2.

switch_to_apple_dictionary()[source]

Switches to searching the Apple Dictionary.

New in version 0.0.2.

switch_to_new_oxford()[source]

Switches to searching the New Oxford American Dictionary.

New in version 0.0.2.

switch_to_oxford_thesaurus()[source]

Switches to searching the Oxford American Writer’s Thesaurus.

New in version 0.0.2.

switch_to_wikipedia()[source]

Switches to searching Wikipedia.

New in version 0.0.2.

view_front_back_matter()[source]

Displays the front/back matter of the selected dictionary.

New in version 0.0.2.