{"id":24715,"library":"tkinterweb","title":"TkinterWeb","description":"TkinterWeb is an HTML/CSS rendering widget for Tkinter. It embeds a web view using the system's web engine (WebKit on macOS, MSHTML on Windows, WebKitGTK on Linux) or a fallback HTML parser. Version 4.25.2 supports Python 3.2+. The library is actively maintained, with releases every few months.","status":"active","version":"4.25.2","language":"python","source_language":"en","source_url":"https://github.com/Andereoo/TkinterWeb","tags":["tkinter","html","css","web-view","gui","browser"],"install":[{"cmd":"pip install tkinterweb","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"HtmlFrame is a class, not a module; must be imported directly.","wrong":"import tkinterweb.HtmlFrame","symbol":"HtmlFrame","correct":"from tkinterweb import HtmlFrame"},{"note":"There is no 'Browser' class in tkinterweb; the main widget is TkinterWeb or HtmlFrame.","wrong":"from tkinterweb import Browser","symbol":"TkinterWeb","correct":"from tkinterweb import TkinterWeb"}],"quickstart":{"code":"import tkinter as tk\nfrom tkinterweb import HtmlFrame\n\nroot = tk.Tk()\nf = HtmlFrame(root, messages_enabled=False)  # disable debug messages\nf.load_website('https://example.com')\nf.pack(fill='both', expand=True)\nroot.mainloop()","lang":"python","description":"Create a simple Tkinter window with an HTML frame loading a URL."},"warnings":[{"fix":"On Linux, install WebKitGTK: sudo apt-get install libwebkit2gtk-4.0-dev","message":"The widget uses the system's native web engine. On Linux, if WebKitGTK is not installed, the library falls back to a limited HTML parser that does not support modern CSS or JavaScript. Always test on target platforms.","severity":"gotcha","affected_versions":"all"},{"fix":"Use HtmlFrame(..., debug=False) or set after creation: frame.configure(messages_enabled=False)","message":"Argument 'messages_enabled' is deprecated in 4.x and may be removed. Use 'debug' or silence messages via configure instead.","severity":"deprecated","affected_versions":">=4.0"},{"fix":"Replace `from tkinterweb import Browser` with `from tkinterweb import HtmlFrame` and adjust usage.","message":"In version 4.0, the API changed from 'Browser' to 'HtmlFrame'. Old code using 'from tkinterweb import Browser' will fail.","severity":"breaking","affected_versions":">=4.0"},{"fix":"Consider using a fallback or avoid complex web content on Windows.","message":"On Windows, the embedded browser uses MSHTML (Internet Explorer) under the hood, which may not render modern HTML5/CSS3 correctly. JavaScript support is limited.","severity":"gotcha","affected_versions":"all"},{"fix":"Encode the file path as URL: `frame.load_file('file:///' + urllib.parse.quote(path))`","message":"Calling `load_file` with a file path containing non-ASCII characters may fail on some platforms due to encoding issues.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use `from tkinterweb import HtmlFrame` instead.","cause":"In version 4.0+, the class was renamed from Browser to HtmlFrame.","error":"ImportError: cannot import name 'Browser' from 'tkinterweb'"},{"fix":"Install WebKitGTK: `sudo apt-get install libwebkit2gtk-4.0-dev` (or equivalent for your distro).","cause":"On Linux, WebKitGTK library is missing, so the widget uses a basic parser without CSS/JS support.","error":"WebViewGTK not installed. Falling back to plain HTML parser."},{"fix":"Ensure the HtmlFrame is added to the UI (pack/grid/place) before calling load_website or other methods.","cause":"The widget is not fully initialized. Usually happens when calling methods before packing/placing the widget.","error":"AttributeError: 'NoneType' object has no attribute 'load_website'"},{"fix":"Reinstall Python with a Tcl/Tk that includes the web view: `brew install python-tk` or use python.org installer.","cause":"On macOS, TkinterWeb requires a properly built Tk installation (e.g., from Python.org or Homebrew). The system Tk may be outdated.","error":"TclError: This didn't work on macOS..."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}