Changelog

The API changed significantly in version 4.

Key Changes
  • Faster load speed

  • A more intuitive API

  • Support for experimental Tkhtml features, such as page printing

  • Widget behaviour and API is now more closely aligned with standard Tkinter widgets

  • Many DOM improvements. The DOM API now more closely mirrors its JavaScript counterpart.

  • Dozens of new configuration options, including access to more settings and the ability to link a JavaScript interpreter

  • Added basic JavaScript support (new in version 4.1)

  • Improved embedded widget handling (new in version 4.2)

  • Cross-platform SVG and border-radius support (new in version 4.4)

  • Support for Tcl 9 (new in version 4.5)

  • Caret browsing functionality (new in version 4.8)

  • Improved thread safety (new in version 4.9)

  • Ability to bind to HTML elements (new in version 4.10)

  • Added an HTML-based text widget (new in version 4.15)

Removed

Version 4.0:

  • HtmlFrame.get_zoom() - use HtmlFrame.cget("zoom")

  • HtmlFrame.set_zoom() - use HtmlFrame.configure(zoom=)

  • HtmlFrame.get_fontscale() - use HtmlFrame.cget("fontscale")

  • HtmlFrame.set_fontscale() - use HtmlFrame.configure(fontscale=)

  • HtmlFrame.get_parsemode() - use HtmlFrame.cget("parsemode")

  • HtmlFrame.set_parsemode() - use HtmlFrame.configure(parsemode=)

  • HtmlFrame.set_message_func() - use HtmlFrame.configure(message_func=)

  • HtmlFrame.set_broken_webpage_message() - use HtmlFrame.configure(on_navigate_fail=). Note that on_navigate_fail requires a function instead.

  • HtmlFrame.set_maximum_thread_count() - use HtmlFrame.configure(threading_enabled=)

  • HtmlFrame.set_recursive_hover_depth() - use HtmlFrame.html.recursive_hover_depth=

  • HtmlFrame.add_visited_links() - use HtmlFrame.configure(visited_links=)

  • HtmlFrame.clear_visited_links() - use HtmlFrame.configure(visited_links=)

  • HtmlFrame.enable_stylesheets() - use HtmlFrame.configure(stylesheets_enabled=)

  • HtmlFrame.enable_images() - use HtmlFrame.configure(images_enabled=)

  • HtmlFrame.enable_forms() - use HtmlFrame.configure(forms_enabled=)

  • HtmlFrame.enable_objects() - use HtmlFrame.configure(objects_enabled=)

  • HtmlFrame.enable_caches() - use HtmlFrame.configure(caches_enabled=)

  • HtmlFrame.enable_dark_theme() - use HtmlFrame.configure(dark_theme_enabled=, image_inversion_enabled=)

  • HtmlFrame.on_image_setup() - use HtmlFrame.configure(on_resource_setup=)

  • HtmlFrame.on_downloading_resource() - bind to <<DownloadingResource>>/utilities.DOWNLOADING_RESOURCE_EVENT

  • HtmlFrame.on_done_loading() - bind to <<DoneLoading>>/utilities.DONE_LOADING_EVENT

  • HtmlFrame.on_url_change() - bind to <<UrlChanged>>/utilities.URL_CHANGED_EVENT and use :attr:.HtmlFrame.current_url`

  • HtmlFrame.on_icon_change() - bind to <<IconChanged>>/utilities.ICON_CHANGED_EVENT and use HtmlFrame.title

  • HtmlFrame.on_title_change() - bind to <<TitleChanged>>/utilities.TITLE_CHANGED_EVENT and use HtmlFrame.title

  • HtmlFrame.on_form_submit() - use HtmlFrame.configure(on_form_submit=)

  • HtmlFrame.on_link_click() - use HtmlFrame.configure(on_link_click=)

  • HtmlFrame.yview_toelement() - use HTMLElement.scrollIntoView()

  • HtmlFrame.get_currently_hovered_node_text() - HtmlFrame.get_currently_hovered_element()

  • HtmlFrame.get_currently_hovered_node_tag() - HtmlFrame.get_currently_hovered_element()

  • HtmlFrame.get_currently_hovered_node_attribute() - HtmlFrame.get_currently_hovered_element()

  • HtmlFrame.get_current_link() - use HtmlFrame.get_currently_hovered_element()

  • The widgetid attribute no longer embeds widgets. Use <object data=name_of_your_widget></object> or HTMLElement.widget instead. This improves load speeds and allows for widget style handling.

Version 4.2:

  • TkinterWeb.replace_widget()

  • TkinterWeb.replace_element()

  • TkinterWeb.remove_widget()

Version 4.8

Version 4.14:

  • The style configuration option no longer sets the CSS style of HtmlLabel widgets. See bug #145.

Deprecated

Version 4.11:

Version 4.12:

Version 4.14:

  • The configuration option default_style - use tkinterweb.utilities.DEFAULT_STYLE or the defaultstyle configuration option.

  • The configuration option dark_style - use tkinterweb.utilities.DARK_STYLE or the defaultstyle configuration option.

  • The configuration option about_page_background - use ttk.Style().configure("TFrame", background=).

  • The configuration option about_page_foreground - use ttk.Style().configure("TFrame", foreground=).

Version 4.16:

Version 4.22:

Renamed

Version 4.0:

Added

Version 4.0:

Version 4.1:

  • HtmlFrame.register_JS_object`()

  • HTMLElement.widget (updated again in version 4.2)

  • HTMLElement.value

  • HTMLElement.checked

  • HTMLElement.onchange

  • HTMLElement.onload

  • HTMLElement.onclick

  • HTMLElement.oncontextmenu

  • HTMLElement.ondblclick

  • HTMLElement.onmousedown

  • HTMLElement.onmouseenter

  • HTMLElement.onmouseleave

  • HTMLElement.onmousemove

  • HTMLElement.onmouseout

  • HTMLElement.onmouseover

  • HTMLElement.onmouseup

  • CSSStyleDeclaration.setProperty

  • CSSStyleDeclaration.getPropertyValue

  • CSSStyleDeclaration.removeProperty

  • TkinterWeb.send_onload()

  • Added support for many JavaScript events.

  • The new configuration option on_element_script can be used to add a callback to run when a JavaScript event attribute on an element is encountered.

  • The new configuration option javascript_enabled can be used to enable JavaScript support.

Version 4.2:

Version 4.4:

Version 4.5:

  • The new configuration option ssl_cafile can be used to provide a path to a CA Certificate file. See bug #28.

Version 4.6:

  • The new configuration option request_timeout can be used to specify the number of seconds to wait before a request times out.

Version 4.7:

  • The new <<DOMContentLoaded>> event will be generated once the page DOM content has loaded. The page may not be done loading, but at this point it is possible to interact with the DOM.

Version 4.8:

Version 4.9:

Version 4.10:

Version 4.11:

Version 4.12:

Version 4.13:

Version 4.14:

  • HTMLElement.innerText

  • The new configuration option request_func can be used to set a custom script to use to download resources.

  • The new configuration option defaultstyle can be used to set the default stylesheet to use when parsing HTML.

Version 4.15:

Version 4.16:

Version 4.17:

  • The new configuration option textwrap can be used to enable or disable text wrapping. In general, text wrapping should be disabled when shrink is enabled, and should be enabled when shrink is disabled. This is the default behaviour. This is only partially supported in Tkhtml 3.0; make sure you have the TkinterWeb-Tkhtml-Extras package installed and up-to-date.

Version 4.18:

  • Added basic support for most HTML5 elements in the corresponding TkinterWeb-Tkhtml-Extras release (version 1.3.0)

  • Added support for the HTML <details>, <summary>, and <q> tags.

Version 4.19:

Version 4.20:

Version 4.21:

Version 4.22:

Version 4.23:

Version 4.24:

Changed/Fixed

Version 4.0:

  • HtmlFrame.configure(), HtmlFrame.config(), HtmlFrame.cget(), and HtmlFrame.__init__() now support more configuration options.

  • HtmlFrame.load_website(), HtmlFrame.load_file(), and HtmlFrame.load_url() no longer accept the insecure parameter. use HTMLElement.configure(insecure=).

  • Enabling/disabling caches now enables/disables the Tkhtml image cache.

  • Threading now cannot be enabled if the Tcl/Tk build does not support it.

  • HTMLElement.remove() now raises a tkinter.TclError when invoked on <html> or <body> elements, which previously caused segmentation faults.

  • HTMLElement.innerHTML and HTMLElement.textContent now raise a tkinter.TclError when invoked on <html> elements, which previously caused segmentation faults.

  • Shorthand CSS properties can now be set and returned after the document is loaded.

  • The ability to style color selector inputs was improved.

  • The ability to access form elements has improved.

  • Text elements now emit the <<Modified>> event after the content updates.

  • The TkinterWeb demo and some of the built-in pages have been updated. Many internal methods and variables have been renamed, removed, or modified.

Version 4.1:

  • HtmlFrame.screenshot_page() is now partially supported on Windows and now accepts the additional parameter show.

  • The default selection and find text colors are less abrupt.

Version 4.2:

  • Widgets embedded in the document can now be removed without removing the containing element.

Version 4.3:

  • Prebuilt Tkhtml binaries have been split off into a new package, TkinterWeb-Tkhtml. This has been done to work towards bug #52 and reduce the download size of the TkinterWeb package when updating.

Version 4.4:

  • HtmlFrame.add_html() is now accepts the additional parameter return_element.

  • It is now only possible to enable experimental mode if an experimental Tkhtml release is detected.

  • Some experimental HTML features were enabled in Windows and Linux. border-radius is now supported!

Version 4.5:

  • Periods are now supported in url fragments. See bug #143 .

  • Tkhtml file loading was updated in version 4.5. Some error messages have also been updated. Please submit a bug report if you notice any issues.

Version 4.6:

  • Url fragments are now tracked as the document loads. This ensures that the fragment is still visible even after loading CSS files or images that change the layout of the document.

  • gzip and deflate content encodings are now supported. Brotli compression is also supported if the brotli module is installed. This increases page load speeds and decreases bandwidth usage in some websites.

  • Pressing Ctrl-A in an HTML number input, text input, or textarea will cause the widget’s text to be selected. Pasting will now overwrite any selected text.

  • Loading local files with a query string in the url will no longer raise an error.

  • Fixed HTMLDocument.querySelector().

Version 4.7:

  • Fixed flickering when moving the mouse over scrollbars in <iframe> elements.

  • bind() calls to the HtmlFrame.bind() respect requests to bind <Enter> and <Leave>. All other events are still bound to the associated TkinterWeb instance. Keep in mind that overriding the default bindings to <Enter> and <Leave> may cause unwanted side effects.

Version 4.8:

  • All HTML widgets now bind to <Up>, <Down>, <Left>, <Right>, <Prior>, <Next>, <Home>, and <End> by default.

  • Fixed HTMLElement.parentElement().

Version 4.9:

  • TkinterWeb is now thread-safe when loading resources. All callbacks now will run on the main thread.

  • Fixed loading of data urls.

  • Local files will now load regardless of the number of slashes before the path.

  • Fixed some dark mode and image inversion bugs.

Version 4.10:

  • Binding button presses and motion events to the widget no longer removes internal bindings.

  • Setting html.maximum_thread_count = 0 no longer disables threading. Use html.threading_enabled = False.

  • PIL is now an optional dependency. I also recommend installing the new TkinterWeb-Tkhtml-Extras package.

  • The HTMLElement.widget property now returns a Tk widget when used on <input>, <textarea>, <select>, <iframe>, and some <object> elements.

  • Fixed scrollbar flashes when the widget opens.

  • DOM objects now provide more useful information when printed.

  • By default, scrolling on embedded widgets now scrolls the page if the embedded widget or subwidgets do not bind to the mousewheel.

  • If dark theme is enabled, HTML code passed to the configuration option dark_style will now be automatically appended onto the code set by default_style.

  • Plain text is no longer rendered as a blank page.

  • The event queue now only runs when threading is enabled.

  • Modifying the selection when selection is disabled now raises an error.

  • Modifying the caret position when caret browsing is disabled now raises an error.

  • Local file loading now happens on the main thread.

  • Fixed a fatal scrollbar error when loading TkinterWeb on Tk 8.5 on MacOS.

  • Fixed a fatal binding error when loading TkinterWeb on MacOS.

  • Many internal changes were made in this release. If you notice any bugs, please report them.

Version 4.11:

  • Fixed some minor bugs.

  • JavaScript events no longer fire when events are disabled.

  • The TkinterWeb widget was restructured in this release. If you notice any bugs, please report them.

Version 4.12:

  • Fixed more minor bugs.

  • Side-scrolling is now supported.

Version 4.13:

  • Fixed more minor bugs, including a segfault when inserting a widget into the page’s root element.

  • grid_propagate(0) and pack_propagate(0) no longer have any effect on the widget. Requested width and height will now always be respected.

Version 4.14:

  • Fixed more minor bugs.

  • The HtmlLabel widget now automatically matches the ttk style.

  • Alternate text for broken images is now displayed natively through Tkhtml.

Version 4.15:

  • Fixed more minor bugs.

  • Improved some error messages.

  • Improved code autocompletion.

  • All HTML widgets now bind to <Ctrl-A> by default.

  • Equality checking between HTMLElement objects is now fully supported.

  • The HtmlText widget is now editable out-of-the-box!

  • The HtmlLabel widget now uses the TLabel style by default instead of TFrame.

Version 4.16:

  • Fixed more minor bugs.

  • HtmlFrame.set_caret_position() now sets the caret relative to the document text when no element is provided.

  • HtmlFrame.set_selection_position() now sets the selection relative to the document text when no elements are provided.

  • A NotImplementedError will now raise when changing some settings via HtmlFrame.configure(). This occurs on settings that have no effect after the widget loads and on the shrink value, which has been causing segfaults when changed after the widget loads. If you absolutely need to change the shrink value on the fly use HtmlFrame.html.configure()

  • Text wrapping has been disabled by default in the HtmlLabel and HtmlFrame(shrink=True) widgets.

Version 4.17:

  • Fixed some HtmlFrame shrink regressions. See bug #147.

  • Fixed some image loading and <iframe> scrolling regressions.

  • Fixed a bug where stopping a page load prevented the page from loading again when caches were enabled.

  • <style> tags and local files are now always evaluated in the main thread.

  • The configuration options horizontal_scrollbar and vertical_scrollbar now accept another option, "dynamic". This behaves like "auto", with the difference that scrollbars are always hidden in HtmlLabel and HtmlFrame(shrink=True) widgets. This is the new default for vertical scrollbars.

Version 4.18:

  • Triple-clicking on text now highlights all text in the line, even if multiple inline elements are present.

  • Fixed some bugs that arose when stopping a page load and introduced some minor optimizations.

Version 4.19:

  • Fixed some bugs.

  • Callbacks now accept None as a valid value.

  • Permitted values for configuration option are now more tightly restricted.

  • CSSStyleDeclaration.cssText can now be set.

Version 4.20:

  • Fixed some regressions and bugs.

  • The HtmlText widget now emits the <<Modified>> event when the user types in it.

Version 4.21:

  • Fixed a bug where <style> and <script> elements were left out of the output from HtmlFrame.save_page(). The output of this method is now the document’s original HTML and is unaffected by JavaScript or DOM changes.

  • Fixed a bug where adding HtmlLabel widgets causes the app to open in the wrong part of the screen.

  • HtmlFrame.current_url no longer returns the working directory when loading plain HTML code.

Version 4.23:

  • Whitespace is now automatically stripped from the page’s title.

  • Improved HtmlFrame.snapshot_page() output formatting and accuracy.

  • In an effort to reduce the widget’s memory footprint, all HTML widgets no longer remember the original HTML code they are displaying:

    • The output of HtmlFrame.save_page() is now the document’s original HTML only when the page has been cached. This is the case when caching is enabled and a url is loaded. Otherwise, HtmlFrame.snapshot_page() is used, with the contents of the <head> tag included if the widget is still loading.

    • HtmlFrame.reload() now only reloads pages loaded from a url.

    The original intent of both both methods is to be used when a url is loaded, and in an ideal world caching should always be enabled.

  • HtmlFrame.reload() and HtmlFrame.save_page() now fully support pages generated through form submissions.

  • The <<UrlChanged>>/utilities.URL_CHANGED_EVENT event now also fires when a url is navigated to.

  • The page cache backend was overhauled in this release. Please file a bug report if you notice any issues.

  • Loading cached stylesheets, scripts, and images no longer spawns new threads. This fixes some bugs when loading cached documents and improves load times on some pages.

  • Disabling the cache now also clears it.

Version 4.24:

Version 4.25:

  • In an effort to closer match stock Tk widgets, debug message behaviour has been adjusted:

    • Debug messages are now disabled by default. Set the configuration option messages_enabled=True to enable them.

    • In an effort to keep backwards compatibility, if the configuration option message_func is set, the value of messages_enabled is ignored.

  • Auto-scrolling behaviour when searching the page for text been improved.

  • Fixed a regression impacting HTMLElement.textContent.


Please report bugs or request new features on the issues page.