Skip to main content

Use any of the 2k+ free FontAwesome icons in your tkinter application.

Project description

GitHub issues License

CTkFontAwesome

Requires Python 3.8+

CTkFontAwesome is a maintained continuation and repackaging of the original TkFontAwesome project by Israel Dryer.

A library that enables you to use FontAwesome icons in your CustomTkinter / Tkinter application.

You may use any of the 2k+ free FontAwesome 6.5 icons. The fill color and size are customized to your specifications and then converted to an object via an optional image backend based on CairoSVG and Pillow that can be used anywhere you would use a tkinter.PhotoImage object.

example-2

Installation

python -m pip install ctkfontawesome

This installs the icon database and SVG lookup helpers without any native or compiled dependencies.

If you also want icon_to_image(), install the optional image dependencies:

python -m pip install "ctkfontawesome[images]"

This installs CairoSVG and Pillow for SVG rasterization and Tk image support.

Icon Browser

CTkFontAwesome includes an installable icon browser for searching the bundled Font Awesome set, previewing icons, and copying ready-to-use CustomTkinter code.

ctkfontawesome-browser

The browser itself is included in the base install, but live image previews require the optional image dependencies:

python -m pip install "ctkfontawesome[images]"

CTkFontAwesome browser

Development

This repository now supports a Poetry-based development workflow.

poetry install

To install the optional image backend in the Poetry environment:

poetry install --extras images

To run the icon browser during development:

poetry run ctkfontawesome-browser

Once installed, you can launch the browser with:

ctkfontawesome-browser

Usage

import tkinter as tk
from ctkfontawesome import icon_to_image

root = tk.Tk()
fb = icon_to_image("facebook", fill="#4267B2", scale_to_width=64)
send = icon_to_image("paper-plane", fill="#1D9F75", scale_to_width=64)

tk.Label(root, image=fb).pack(padx=10, pady=10)
tk.Button(root, image=send).pack(padx=10, pady=10)

root.mainloop()

Usage Without Image Dependencies

from ctkfontawesome import icon_to_svg

svg = icon_to_svg("facebook")
print(svg[:80])

example-1

API: icon_to_image()

(
    name=None,
    fill=None,
    scale_to_width=None,
    scale_to_height=None,
    scale=1
)

Parameters

Name Type Description Default
name str The name of the FontAwesome icon. None
fill str The fill color of the svg path. None
scale_to_width int Adjust image width to this size (in pixels); maintains aspect ratio. None
scale_to_height int Adjust image height to this size (in pixels); maintains aspect ratio. None
scale float Scale the image width and height by this factor. 1

API: icon_to_svg()

Returns the raw SVG XML string for the requested icon name.

License

The CC BY 4.0 license applies to all FontAwesome free icons used in the library. The MIT License applies to all other work.


Maintainer: Clive Bostock Original project concept and implementation by Israel Dryer 📦 Available on PyPI | 🐙 GitHub

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ctkfontawesome-0.4.0.tar.gz (481.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ctkfontawesome-0.4.0-py3-none-any.whl (481.9 kB view details)

Uploaded Python 3

File details

Details for the file ctkfontawesome-0.4.0.tar.gz.

File metadata

  • Download URL: ctkfontawesome-0.4.0.tar.gz
  • Upload date:
  • Size: 481.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.3 CPython/3.10.14 Linux/6.8.0-63-generic

File hashes

Hashes for ctkfontawesome-0.4.0.tar.gz
Algorithm Hash digest
SHA256 8f0faef9c11966442cbda1ae0f7714ef0f834b68c5a3e21b65e01ec6591e284c
MD5 22d6a031b4ff8f44575c8dc89eed06f2
BLAKE2b-256 aeac3b7dcfbbe25b593ccd16d97097fdbcefc65b793080c7cb963309ace58618

See more details on using hashes here.

File details

Details for the file ctkfontawesome-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: ctkfontawesome-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 481.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.3 CPython/3.10.14 Linux/6.8.0-63-generic

File hashes

Hashes for ctkfontawesome-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 80feade7c85856246b3074af0d7fc18d9c4c2260490f8cb5b32499244289c931
MD5 dc92ff61bfe7228679ce81676d5c5535
BLAKE2b-256 380b758692b1d4680930f8244cbe217b6ac26e91c48902e325cdeed424e4fc55

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page