Frequently Asked Questions
How do I load websites or files?
Use the
load_website()orload_file()commands. Alternatively, use theload_url()command to load any generic url, but keep in mind that the url must be properly formatted, because the url scheme will not be automatically applied. As always, check out the HTML Widgets Documentation for more information.
How do I manage clicks and use custom bindings?
The
on_link_clickconfiguration option can be used to assign a custom function to link clicks. Likewiseon_form_submitcan be used to handle form submissions. See the HTML Widgets Documentation for more information.Like any other Tkinter widget, mouse and keyboard events can be bound to the
HtmlFramewidget and associated HTML elements. See the Getting Started page for more information.
TkinterWeb is crashing
That is defenitely not normal. Make sure your are using the most up-to-date TkinterWeb version and have crash protection enabled.
If you are using a
ttk.Notebookin your app, see the question below.If all else fails, file a bug report. Post your operating system, Python version, and TkinterWeb version, as well as any error codes or instructions for reproducing the crash.
I’m having issues when using shrink or the HtmlLabel widget
See Creating a Label Widget for more information.
My app crashes when I open a tab with an HtmlFrame in it
Tkhtml (the underlying HTML engine) and the
ttk.Notebookwidget aren’t compatable on 64-bit Windows.This is a known issue. Fixing this is beyond the scope of this project, but working around it is easy.
Instead of using
ttk.Notebook, usetkinterweb.Notebook. This is a wrapper around ttk.Notebook that is designed to be a drop-in replacement for thettk.Notebookwidget. It should look and behave exactly like attk.Notebookwidget, but without the crashes. See bug #19 for more information.Please note that after adding a widget to the Notebook (eg.
mynotebook.add(mywidget)) there is no need to callpack()orgrid()the widget. This may raise errors. TkinterWeb’s Notebook widget handles all this on its own.
I get a ModuleNotFoundError after compiling my code
When compiling your code, you might get an error popup saying
ModuleNotFoundError: The files required to run TkinterWeb could not be foundYour app might also fail quietly if TkinterWeb’s dependencies are not installed
This occurs when your Python script bundler isn’t finding all the files nessessary for running TkinterWeb. You need to force it to get all of TkinterWeb’s files and dependencies.
On PyInstaller: make sure you are using the latest version of PyInstaller by running
pip install --upgrade pyinstaller pyinstaller-hooks-contrib. Otherwise, you can also add the flags--collect-all tkinterweb --collect-all tkinterweb_tkhtml --collect-all tkinterweb_tkhtml_extraswhen bundling your app.On py2app / py2exe: Add
'packages': ['tkinterweb', 'tkinterweb_tkhtml', 'tkinterweb_tkhtml_extras']to theOPTIONSvariable in your setup file.
Please report bugs or request new features on the issues page.