Skip to main content

View Simple HTML docs on tkinter

Project description

tkhtmlview

FOSSA Status

HTML widgets for tkinter

Fork of tk_html_widgets

Overview

This module is a collection of tkinter widgets whose text can be set in HTML format. A HTML widget isn't a web browser frame, it's only a simple and lightweight HTML parser that formats the tags used by the tkinter Text base class. The widgets behaviour is similar to the PyQt5 text widgets (see the PyQt5 HTML markup subset).

Installation

pip install tkhtmlview

Requirements

Example

import tkinter as tk
from tkhtmlview import HTMLLabel

root = tk.Tk()
html_label = HTMLLabel(root, html='<h1 style="color: red; text-align: center"> Hello World </H1>')
html_label.pack(fill="both", expand=True)
html_label.fit_height()
root.mainloop()

Documentation

Classes:

All widget classes inherits from the tkinter.Text() base class.

class HTMLScrolledText(tkinter.Text)

Text-box widget with vertical scrollbar

class HTMLText(tkinter.Text)

Text-box widget without vertical scrollbar

class HTMLLabel(tkinter.Text)

Text-box widget with label appereance

Methods:

def set_html(self, html, strip=True):

Description: Sets the text in HTML format.
Args:

  • html: input HTML string
  • strip: if True (default) handles spaces in HTML-like style

def fit_height(self):

Description: Fit widget height in order to display all wrapped lines

HTML support:

Only a subset of the whole HTML tags and attributes are supported (see table below). Where is possibile, I hope to add more HTML support in the next releases.

Tags Attributes Notes
a style, href
b style
br
code style
div style
em style
h1 style
h2 style
h3 style
h4 style
h5 style
h6 style
i style
img src, width, height experimental support for remote images
li style
mark style
ol style, type 1, a, A list types only
p style
pre style
span style
strong style
u style
ul style bullet glyphs only

License

FOSSA Status

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

tkhtmlview-0.1.1.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

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

tkhtmlview-0.1.1-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file tkhtmlview-0.1.1.tar.gz.

File metadata

  • Download URL: tkhtmlview-0.1.1.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for tkhtmlview-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a358bbcea66ca92334e269c4e9cab4f48f41ed9906f93690218d3ca8cff26a35
MD5 28b07029238bbb42a52bc979bc91d96c
BLAKE2b-256 7363879c34d431f862bf27e0844d279db35ec9b05a634335118fc68beeb62dea

See more details on using hashes here.

File details

Details for the file tkhtmlview-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: tkhtmlview-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for tkhtmlview-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cadf279f57d078da8ab1512dc19d349c0855994041be784b4a12566670023b8e
MD5 77700caf8ddc5159c6252987f5de66cd
BLAKE2b-256 a917f15b2fea261049e6a79273ab58305124d83b10fff1f535201a4b34ec71fc

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