PraktiXtensions are Python scripts that add a tab with a TkInter-GUI to
the extension window. They can use any modules imported in PraktiCalc. For the graphical user interface, ttk-Widgets should be used. If
that's not possible, consider using the value of the DarkMode parameter
to set the background and foreground colors.
A full extension has three files: the Python file with the code itself, a
metadata file and a description. These metadata entries will be shown
by the built-in extension manager. You can distribute your extensions as
a single PXT file, which is basically a renamed ZIP archive.
Consider using the PXT Builder (which is an extension itself) for comfortably building PXT files from Python files.
The metadata file (info.ini)
The metadata file stores metadata for the extension. Here is an example:
[PraktiXtension]
name = PXT Builder
version = 1.0
filename = PXTBuilder.py
description = The PraktiCalc Extension Builder
website =
minpython = default
maxpython = default
sha256 = 10cd7d91f03fb86c59222f49eb05847142356032604973178760a3dc77aa9b80
requiresinternet = false
pxtxlink = Every metadata file starts with the main section [PraktiXtension], which is also the only section. Then, the name, version and filename are specified. The name that you put into name will show up as the tab label in the extension window and doesn't have to be related to the file name. In description, you can put a very short description or subtitle. You can write a longer one later elsewhere.
If you want, you can put a link into website, so users can click on the website button in the extension manager to visit your website.
minpython and maxpython specify the minimal and maximal Python versions your extension supports. It's recommended to make an extension that is compatible with Python 3.8 and any newer version though. If an extension isn't compatible with the user's Python version, extension manager won't load it. Just write default into both if it's compatible with all Python versions that PraktiCalc supports, then extension manager will just ignore it.
PraktiCalc uses the latest Python version in the macOS and Windows 11 builds, uses a bit of an older version in the Linux AppImage builds and it uses Python 3.8.20 in the Windows 7 builds. On Debian, TinyCore and Fedora Linux, it uses the system Python version.
In sha256, you can put the sha256 hash of the main file that you also specified in filename. Leave it empty for now.
If your extension requires an internet connection, set requiresinternet to true, if not, set it to false.
pxtxlink is for the future when a new extension format will come to PraktiCalc.
The long description (description.txt)
Just make a text file for your long description called description.txt and write it down there. Nothing fancy here.
The main file
Now, after specifying the metadata and description, you can start writing an extension. Just create a new Python file with the name you specified earlier in filename. Start like this:
import tkinter as tk
from tkinter import ttk
class PXTBuilder(ttk.Frame):
def __init__(self, tabs, parent, mainWin, helper, calculator, dialog, DarkMode):
super().__init__(tabs)
Replace PXTBuilder with the file name minus the extension (.py).
You now have a ttk.Frame where you can put some widgets. You can also import more stuff if you want, everything that's imported in PraktiCalc itself should work.
Python modules you can use and depend on in your extension:- tkinter (+ ttk, messagebox, font, scrolledtext, filedialog, colorchooser)
- Path from pathlib
- Decimal from decimal
- platform
- subprocess
- sys
- shutil
- math
- getpass
- time
- configparser
- importlib.util
- webbrowser
- zipfile
- tempfile
- hashlib
- re
Modules you can use, but shouldn't depend on, as they aren't available on all platforms:- ThemedStyle from ttkthemes
- winreg
- plistlib
- ctypes
- wintypes from ctypes
Also, prefer ttk-widgets over tk-widgets. If
that's not possible, consider using the value of the DarkMode parameter
to set the background and foreground colors.
For error dialogs, use dialog.error(<yourmessage>, parent, helper).
When it comes to depending on PraktiCalc code itself, please only depend on calculator.quickCalc, mainWin.ScaleFactor, dialog and the extension window (parent), if possible. Other parts could change in the future and make your extension incompatible.
If you wondered where you could specify the license shown in the extension manager, you can to it here using the
SPDX license identifier.
When you're done, put the three files into a ZIP archive and call it like the main file, but with the .pxt extension instead of .py.
You can also use the PXT Builder for easier packaging and metadata management.