Andereoo / TkinterWeb

Python bindings for Tkhtml.
MIT License
153 stars 16 forks source link
bindings css html python tcl-tk tkinter tkinter-applications

TkinterWeb

A fast and lightweight cross-platform webbrowser widget for Tkinter.

   

Overview

TkinterWeb offers bindings for the Tkhtml3 widget from http://tkhtml.tcl.tk/tkhtml.html, which enables loading HTML and CSS code into Tkinter applications.

All major operating systems running Python 3+ are supported.

   

Usage

TkinterWeb provides:

TkinterWeb can be used in any Tkinter application. Here is an example:

from tkinterweb import HtmlFrame #import the HTML browser
try:
  import tkinter as tk #python3
except ImportError:
  import Tkinter as tk #python2

root = tk.Tk() #create the tkinter window
frame = HtmlFrame(root) #create the HTML browser
frame.load_website("http://tkhtml.tcl.tk/tkhtml.html") #load a website
frame.pack(fill="both", expand=True) #attach the HtmlFrame widget to the parent window
root.mainloop()

TkinterWeb

Some other tricks, such as handling page title changes, link clicks, and navigation key presses, can be found in the HtmlFrame documentation

   

Installation

To install TkinterWeb, simply type pip install tkinterweb in the command prompt or terminal. That's it.

   

Dependencies

In order to load webpages and show images, TkinterWeb requires the following packages:

Pip will automatically install PIL when installing TkinterWeb.

   

API documentation

TkinterWeb ships with a few classes that make it quick and easy to use.

Documentation and additional information for these classes can be found in the corresponding API refrence pages:

   

FAQs

See https://github.com/Andereoo/TkinterWeb/blob/main/tkinterweb/docs/FAQ.md.

   

Webpage Compatability

HTML/CSS:

JavaScript:

Images:

   

Contributing

TkinterWeb happily accepts contributions.

The best way to contribute to this project is to go to the issues tab and report bugs or submit a feature request. This helps TkinterWeb become more stable and full-featured. Please check the FAQs and closed bugs before submitting a bug report to see if your question as already been answered.

   

Credits

TkinterWeb is powered by the Tkhtml project.

Thanks to the TkinterHtml package for providing the bindings which this project is based on.

Thanks to the BRL-CAD project for providing modifications for Tkhtml on 64-bit Windows platforms.

Thanks to Google Fonts for providing the font used for generating alternate text when images fail to load.

A special thanks to everyone else who helped this project by reporting bugs, creating pull requests, and providing suggestions!