Skip to main content

tkMandelbrotSet

Source code: GitHub

The tkMandelbrotSet package provides a python class MandelbrotSet for generating Mandelbrot sets. It also provides a tkinter application for visualizing and interacting with (e.g., zooming into) the Mandelbrot set.

Application Features:

  • The Mandelbrot set is visualized by a matplotlib pcolormesh figure.
  • The user can zoom into the Mandelbrot set visualization by clicking and dragging a zooming rectangle with the mouse.
  • The user can move backward and forward through the history of zooms.
  • Red numbered rectangles on the visualization indicate the location of previous zooms.
  • The user can "prune" the history of zooms to eliminate unwanted zoom locations.
  • The user can visualize the Mandelbrot set using different colormaps.
  • The user can export the Mandelbrot set visualization to an image file.

Application Known Issues and Limitations:

  1. File|Open..., File|Save, and File|Save As... menu bar options are not currently implemented. File open and save dialogs will be presented, but no action will be taken when they are closed.

References:

  1. https://en.wikipedia.org/wiki/Mandelbrot_set
  2. "The Mandelbrot Set," by Branner, Bodil, "Chaos and Fractals: The Mathematics Behind the Computer Graphics," Devaney, Robert L., and Linda Keen, eds., Proceedings of Symposia in Applied Mathematics, Volume 39, American Mathematical Society, 1989, pp. 75-106.

Requirements

Credit where credit is due

  • The Memento design pattern used to snapshot the state of the MandelbrotSet class follow the concepts, UML diagrams, and examples provided in "Design Patterns: Elements of Reusable Object-Oriented Software," by Eric Gamma, Richard Helm, Ralph Johnson, and John Vlissides, published by Addison-Wesley, 1995.

Application Usage

To launch the application for interacting with and visualizing the Mandelbrot set:

python -m tkMandelbrotSet.mandelbrot_set_app

Choose Help | View Help... from the application's menu bar to read instructions for using the application.

Advanced Usage

You can use the MandelbrotSet class to generate your own Mandelbrot set results.

import matplotlib.pyplot as plt
from tkMandelbrotSet.mandelbrot import MandelbrotSet, plot_mandelbrot_set

# Generate the Mandelbrot set
upper_left_corner = complex(real=-2.0, imag=2.0)
lower_rigt_corner = complex(real=1.0, imag=-2.0)
number_real_axis_pts = 500
number_imag_axis_pts = 500
ms = MandelbrotSet(upper_left_corner, lower_right_corner, number_real_axis_pts, number_imag_axis_pts)
ms.generate_mandelbrot_set()

# Get the plotting data
(x, y, z) = ms.get_plot_data(True)

# Visualize the Mandelbrot set
plot_mandelbrot_set(x, y, z)
plt.show()

Unittests

Unit tests for tkMandelbrotSet have filenames starting with test_. To run the unit tests, type python -m unittest discover -s .\..\tests -v in a terminal window in the project directory.

While the unit tests are executing, a few tkinter windows will appear and disappear, as the application is being tested.

License

MIT License. See the LICENSE file for details

Metadata

Release files for tkMandelbrotSet 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tkMandelbrotSet 1.1.0
File Size Uploaded
tkmandelbrotset-1.1.0.tar.gz 33.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tkMandelbrotSet 1.1.0
File Interpreter ABI Platform
tkmandelbrotset-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 62.7 kB

Release files / tkmandelbrotset-1.1.0.tar.gz

Download URL tkmandelbrotset-1.1.0.tar.gz
Size 33.1 kB
Tags Source
SHA-256 checksum
How to use checksums
2d2c07dd702e4729f1b8c2a257199277054e0ecba722790e4aa306392bfe9e83
BLAKE2b-256 checksum
How to use checksums
5b4c02c7e5c566027c13366669be8b4680a7f2fba702b896cfcbcb5034105f81
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 16, 2026.

Transparency log

Release files / tkmandelbrotset-1.1.0-py3-none-any.whl

Download URL tkmandelbrotset-1.1.0-py3-none-any.whl
Size 29.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eecad535940ab73c7c4fec294f6487e651aa9414403a7d6002adda577afe6e36
BLAKE2b-256 checksum
How to use checksums
103b31d78120be8c05f29ad6a854cc42d32efd4cd13249bf0661439292b31f61
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 16, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page