Setting up TkHtml (a Tk widget) with Python
tkinter python examples
tkinter python 3
tkinter python documentation
tkinter python 3 download
tkinter python 3 tutorial
python tkinter tutorial
I need a simple way to render HTML pages retrieved with Requests (python-requests.org). I'm using Python 3.2 on Windows.
I was using tkinter, and I found a Tk widget called TkHtml. It is described at http://tkhtml.tcl.tk/ and a DLL is downloadable from http://www.hwaci.com/sw/tkhtml/. I found a python wrapper at http://tix.sourceforge.net/Tixapps/src/Python/TkHtml.py.
I don't know how to get TkHtml working in python. Is there some standard way of handling 3rd party Tk widgets?
I put tkhtml.dll in Python32\DLLs (no idea if this is right) and put TkHtml.py in Python32\Lib\site-packages. I went ahead and fixed the imports in TkHtml.py to work with Python 3 (changed tkFileDialog to tkinter.filedialog and Tkinter to tkinter).
When I do:
import TkHtml app=TkHtml.TestApp()
I get the error:
... File "C:\Program Files\Python32\lib\site-packages\TkHtml.py", line 45, in __init__ master.tk.call("package", "require", "tkhtml") _tkinter.TclError: can't find package tkhtml
Find your Python tcl directory eg. C:\Python32\tcl . This is where tcl/tk extensions go.
Create a new folder in there called Tkhtml.
Into this folder put (1) your .dll file , (2) a text file called pkgIndex.tcl
pkgIndex.tcl contains a line like this:
package ifneeded Tkhtml 0.0 [list load [file join $dir tkhtml.dll]]
If you can do this at the python prompt,
>>> import Tkinter #tkinter >>> root = Tkinter.Tk() >>> root.tk.eval('package require Tkhtml') '0.0'
... then the package is available. The string
'0.0' represents the version number.
Graphical User Interfaces with Tk — Python 3.8.5 documentation, tkinter is a set of wrappers that implement the Tk widgets as Python classes. In addition, the internal module _tkinter provides a threadsafe mechanism which� Tkinter in Python comes with a lot of good widgets. Widgets are standard graphical user interface (GUI) elements, like different kinds of buttons and menus. Most of the Tkinter widgets are given here. Label Widget A Label widget shows text to the user. You can update the widget programmatically to, for example, provide a readout …
I created a pip-installable Python wrapper for Tkhtml3: https://bitbucket.org/aivarannamaa/tkinterhtml
It comes with TkHtml3 binaries for Windows, Mac and Linux.
tk-html-widgets � PyPI, HTML widgets for tkinter. pip install tk-html-widgets. Copy PIP instructions This module is a collection of tkinter widgets whose text can be set in HTML format. A HTML Python 3.4 or later with tcl/tk support; Pillow 5.3.0� tk_html_widgets. HTML widgets for tkinter. 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.
I am using Python 3.3 on Windows 8 (64-bit) and received the same package load error as the OP.
I too had downloaded and saved
.py files to these following folders:
tkhtml.dll -> D:\Python3.3\DLL TkHtml.py -> D:\Python3.3\Lib\site-packages
Based on noob oddy's suggestion, I did the following:
tkhtml.dll -> D:\Python3.3\tcl\Tkhtml pkgIndex.tcl -> D:\Python3.3\tcl\Tkhtml
And copied this line:
package ifneeded Tkhtml 0.0 [list load [file join $dir tkhtml.dll]] into the
What finally did the trick for me was moving everything from
Python3.3 folder to
Python2 folder. The HTML renderer worked beautifully. It seems that
TkHtml is not be compatible with Python 3.
tkhtml - the Tcler's Wiki!, http://tkhtml.tcl.tk/ is the home page for one of the Tk HTML widgets that renders the tkhtml cvs accessible as well as setting up a new web site about tkhtml. Suite of development applications that run with Tcl/Tk/Tix or Python/Tkinter/Tix. This answer is based on Rachel's answer.Her code did not work originally, but with some tweaking I was able to fix the mistakes. import tkinter as tk root = tk.Tk() # create a Tk root window w = 800 # width for the Tk root h = 650 # height for the Tk root # get screen width and height ws = root.winfo_screenwidth() # width of the screen hs = root.winfo_screenheight() # height of the screen
HTML widgets - the Tcler's Wiki!, An HTML widget can be used to display help and manual documents in an application. No public version repository or project celebration website is set up for this. A TclOO Tkhtml 3.0 megawidget - example of how to render html+ css, 2017 PTUI, A Tkinter-based IDE for Python, not Tcl. It includes an HTML viewer� Download files. Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
[PDF] Tkhtml 3.0, Tkhtml is a Tk widget written in C that displays documents formatted according to the Tkhtml 2 is written in the C language, and has been used by applications written in Tcl, Ruby, Python and not possible to set appropriate CSS properties using standard CSS Optionally, navigate up the tree to the root. 25.2. tkinter.ttk — Tk themed widgets¶. The tkinter.ttk module provides access to the Tk themed widget set, introduced in Tk 8.5. If Python has not been compiled against Tk 8.5, this module can still be accessed if Tile has been installed.
25. Graphical User Interfaces with Tk — Python 3.6.3 documentation, tkinter is a set of wrappers that implement the Tk widgets as Python classes. In addition, the internal module _tkinter provides a threadsafe mechanism which� T.insert(tk.END, quote) tk.mainloop() The result is a lot better. We have now always 4 lines in view, but all lines can be viewed by using the scrollbar on the right side of the window:
- A bit more documentation would help.