Addon API Reference

Addon API has some useful API.

class AddonAPI
Canonical

libmarusoftware.addon.AddonAPI

api_ver: int

Addon API Version

api_ver_minor: int

Addon API Minor Version

name: str

Addon Name

logger: Logger

Logger object for addon

appinfo: dict

Marutools runtime infomation

ext: str

Open file extention

ui: UI

UI controler

app: Core

Marutools Core

saved: bool

Flag for is saved file.

UI

UI controling classes

Note

These are only Widget creation function. Widget creation function returns Widget object. To control Widget, you have to use function in Widget object.

class UI
parent

Parent UI object. If not having, it is None.

type: str
UI object type. UI object is showing Frame widget or window.
main: Main window
frame: Frame widget
dialog: Dialog widget(like Warning window…)
sub: Sub window
backend: str
Backend name.
tkinter:tkinter GUI library
changeTitle(title)

Change window title.

Warning

This works successfully only when UI object type is main or sub

Parameters

title (str) – Title to set.

changeIcon(icon_path)

Change window icon(it’s on title bar and task bar).

Warning

This works successfully only when UI object type is main or sub

Parameters

title (str) – Icon file path to set.

fullscreen(tf=None)

Change window to fullscreen.

Warning

This works successfully only when UI object type is main or sub

Parameters

tf (bool) – True to fullscreen. False to fullscreen. default(None) to nomal size.

changeSize(size)

Change window size.

Warning

This works successfully only when UI object type is main or sub

Parameters

size (str) – {width}x{height}+{x}+{y}

uisetting(frame, txt)

The widget for UI setting.

Parameters
  • frame (libmarusoftware.Frame) – Frame to show settings.

  • txt (Lang) – l10n text in dict like object

setcallback(name, callback)

Set callback.

Parameters
  • name (str) –

    Callback name.
    close: Fire on close window.
    macos_help: Click help menu button on Macos
    macos_settings:Click settings menu button on Macos

  • callback (callable) – Callback function.

makeSubwindow(dialog=False, **options)

Make Subwindow

Parameters

dialog (bool) – Dialog mode.

close()

Close window/frame.

wait()

Wait until close window.

Warning

This works successfully only when UI object type is main or sub

exist()

Return whether the window/frame is open.

Returns

whether the window/frame is open.

Return type

bool

mainloop()

Window Mainloop.

Warning

This works successfully only when UI object type is main. And also, must NOT BE run twice or above.

Frame()

Frame widget.

Returns

Frame widget object

Return type

UI

Label(label=None)

Label widget.

Parameters

label (str) – Label text

Returns

Label widget object

Return type

WidgetBase

Image(image=None)

Image widget.

Returns

Image widget object

Return type

WidgetBase

Menu()

Menu widget.

Returns

Menu widget object

Return type

Menu

Notebook()

Notebook widget.

Returns

Notebook widget object

Return type

Notebook

Dialog: Dialog
Input: Input
class Dialog
askfile(multi=False, save=False)

Ask filepath Dialog.

Parameters
  • multi (bool) – Multi selection enable/disable

  • save (bool) – Save filepath(True) or Open filepath(False)

Returns

Filepath

Return type

str or None

askdir()

Ask directory(folder) path Dialog.

Returns

Directory path

Return type

str

error()

Show error Dialog.

info()

Show infomation Dialog.

warn()

Show warning Dialog.

question(type, title, message)

Asking Dialog.

Parameters
  • type (str) –

    Ask type.
    okcancel: select “ok”(return True) or “cancel”(return False)
    retrycancel: select “retry”(True) or “cancel”(False)
    yesno: select “yes”(True) or “no”(False)
    yesnocancel: select “yes”(True) or “no”(False) or “cancel”(None)
    text: Input text. If cancel, return None

  • title (str) – Dialog title

  • message (str) – Dialog message

Returns

Selected (or Inputed) value.

Return type

bool or str or None

class Input
Button(label='', command=None)

Button widget.

Parameters
  • label (str) – Button label.

  • command (callable) – Button on-clicking callback

Returns

Button widget object

Return type

Button

List()

List widget.

Returns

List widget object

Return type

List

Form(type='text', command=None)

Text inputting widget.(just one line)

Parameters
  • type (str) –

    Form type.
    text: Normal plain text input.
    password: Password input.
    filesave: Save file asking.
    fileopen: Open file asking.
    fileopenmulti: Open file asking (multiple).
    filesavemulti: Save file asking (multiple).

  • command (callable) – Form on-changing callback

Returns

Form widget object.

Return type

Form

Text(scroll=True, command=None)

Text inputting widget.(multi line)

Parameters
  • scroll (bool) – Scrollbar

  • command (callable) – Text on-changing callback

  • readonly (bool) – Readonly

Returns

Text widget object

Return type

Text

CheckButton(label=None, command=None, default=False)

Check button widget.

Parameters
  • label (str) – Button label.

  • command (callable) – CheckButton on-clicking callback

  • default (bool) – Default value.

Returns

CheckButton widget object

Return type

CheckButton

Select(default='', command=None, values=[], inline=False, label='')

Select widget.

Parameters
  • default (str) – Default value

  • command (callable) – on-selecting callback

  • values (List[str]) – Values to select

  • inline (bool) – Inline mode

  • label (str) – Select label(on left)

Returns

Select widget object

Return type

Select

Logger

Now writing…..

class Logger