tkinterweb 4.16.7__tar.gz → 4.16.9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {tkinterweb-4.16.7/tkinterweb.egg-info → tkinterweb-4.16.9}/PKG-INFO +1 -1
- {tkinterweb-4.16.7 → tkinterweb-4.16.9}/setup.py +1 -1
- {tkinterweb-4.16.7 → tkinterweb-4.16.9}/tkinterweb/bindings.py +4 -3
- {tkinterweb-4.16.7 → tkinterweb-4.16.9}/tkinterweb/extensions.py +4 -4
- {tkinterweb-4.16.7 → tkinterweb-4.16.9}/tkinterweb/htmlwidgets.py +22 -19
- {tkinterweb-4.16.7 → tkinterweb-4.16.9}/tkinterweb/utilities.py +3 -4
- {tkinterweb-4.16.7 → tkinterweb-4.16.9/tkinterweb.egg-info}/PKG-INFO +1 -1
- {tkinterweb-4.16.7 → tkinterweb-4.16.9}/LICENSE.md +0 -0
- {tkinterweb-4.16.7 → tkinterweb-4.16.9}/MANIFEST.in +0 -0
- {tkinterweb-4.16.7 → tkinterweb-4.16.9}/README.md +0 -0
- {tkinterweb-4.16.7 → tkinterweb-4.16.9}/setup.cfg +0 -0
- {tkinterweb-4.16.7 → tkinterweb-4.16.9}/tkinterweb/__init__.py +0 -0
- {tkinterweb-4.16.7 → tkinterweb-4.16.9}/tkinterweb/dom.py +0 -0
- {tkinterweb-4.16.7 → tkinterweb-4.16.9}/tkinterweb/handlers.py +0 -0
- {tkinterweb-4.16.7 → tkinterweb-4.16.9}/tkinterweb/imageutils.py +0 -0
- {tkinterweb-4.16.7 → tkinterweb-4.16.9}/tkinterweb/js.py +0 -0
- {tkinterweb-4.16.7 → tkinterweb-4.16.9}/tkinterweb/resources/combobox-2.3.tm +0 -0
- {tkinterweb-4.16.7 → tkinterweb-4.16.9}/tkinterweb/resources/pkgIndex.tcl +0 -0
- {tkinterweb-4.16.7 → tkinterweb-4.16.9}/tkinterweb/subwidgets.py +0 -0
- {tkinterweb-4.16.7 → tkinterweb-4.16.9}/tkinterweb.egg-info/SOURCES.txt +0 -0
- {tkinterweb-4.16.7 → tkinterweb-4.16.9}/tkinterweb.egg-info/dependency_links.txt +0 -0
- {tkinterweb-4.16.7 → tkinterweb-4.16.9}/tkinterweb.egg-info/requires.txt +0 -0
- {tkinterweb-4.16.7 → tkinterweb-4.16.9}/tkinterweb.egg-info/top_level.txt +0 -0
|
@@ -50,12 +50,13 @@ class TkinterWeb(tk.Widget):
|
|
|
50
50
|
# kwargs["logcmd"] = tkhtml_notifier
|
|
51
51
|
|
|
52
52
|
# Set the default style if needed
|
|
53
|
+
if kwargs.get("shrink", False) == True:
|
|
54
|
+
# will be much easier once I remove default_style
|
|
55
|
+
setattr(self, "default_style", getattr(self, "default_style", "") + utilities.SHRINK_STYLE)
|
|
56
|
+
|
|
53
57
|
if kwargs.get("defaultstyle", "") == "" and self.default_style:
|
|
54
58
|
kwargs["defaultstyle"] = self.default_style
|
|
55
59
|
|
|
56
|
-
if kwargs.get("shrink", False) == True:
|
|
57
|
-
kwargs["defaultstyle"] += utilities.SHRINK_STYLE
|
|
58
|
-
|
|
59
60
|
# Unset width and height if -0
|
|
60
61
|
if kwargs.get("width") == 0:
|
|
61
62
|
del kwargs["width"]
|
|
@@ -289,7 +289,7 @@ class CaretManager(utilities.BaseManager):
|
|
|
289
289
|
:ivar target_offset: The text offset used for traversing up/down.
|
|
290
290
|
:ivar blink_delay: The caret's blink delay, in milliseconds. Updated in version 4.11.
|
|
291
291
|
:ivar caret_width: The caret's width, in pixels. New in version 4.11.
|
|
292
|
-
:ivar
|
|
292
|
+
:ivar caret_color: The caret's colour. If None, the text colour under it will be matched.
|
|
293
293
|
:ivar scrolling_threshold: If the distance between the visible part of the page and the caret is nonzero but is less than this number, a scrolling animation will play.
|
|
294
294
|
:ivar scrolling_teleport: If the distance between the visible part of the page and the caret is nonzero but is greater than :attr:`scrolling_threshold`, the page is scrolled to this number before the scrolling animation plays.
|
|
295
295
|
|
|
@@ -307,7 +307,7 @@ class CaretManager(utilities.BaseManager):
|
|
|
307
307
|
|
|
308
308
|
self.blink_delays = [600, 300]
|
|
309
309
|
self.caret_width = 1
|
|
310
|
-
self.
|
|
310
|
+
self.caret_color = None
|
|
311
311
|
self.scrolling_threshold = 300
|
|
312
312
|
self.scrolling_teleport = 75
|
|
313
313
|
|
|
@@ -549,8 +549,8 @@ class CaretManager(utilities.BaseManager):
|
|
|
549
549
|
xoffset = self._scroll_if_needed(a, c, x1, x2, auto_scroll, 1)
|
|
550
550
|
|
|
551
551
|
if (xoffset != None) and (yoffset != None): # Otherwise, yview/xview automatically re-calls this function, so we exit
|
|
552
|
-
if self.
|
|
553
|
-
bg = self.
|
|
552
|
+
if self.caret_color:
|
|
553
|
+
bg = self.caret_color
|
|
554
554
|
else:
|
|
555
555
|
bg = self.html.get_node_property(self.html.get_node_parent(self.node), "color")
|
|
556
556
|
self.caret_frame.config(height=d-b, bg=bg, width=self.caret_width)
|
|
@@ -91,19 +91,19 @@ class HtmlFrame(Frame):
|
|
|
91
91
|
:param ignore_invalid_images: If enabled and alt text is disabled or the image has no alt text, a broken image icon will be displayed in place of the image.
|
|
92
92
|
:type ignore_invalid_images: bool
|
|
93
93
|
|
|
94
|
-
Widget
|
|
94
|
+
Widget colours and styling:
|
|
95
95
|
|
|
96
|
-
:param find_match_highlight_color: The
|
|
96
|
+
:param find_match_highlight_color: The background colour of matches found by :py:func:`find_text()`.
|
|
97
97
|
:type find_match_highlight_color: str
|
|
98
|
-
:param find_match_text_color: The
|
|
98
|
+
:param find_match_text_color: The foreground colour of matches found by :py:func:`find_text()`.
|
|
99
99
|
:type find_match_text_color: str
|
|
100
|
-
:param find_current_highlight_color: The
|
|
100
|
+
:param find_current_highlight_color: The background colour of the current match selected by :py:func:`find_text()`.
|
|
101
101
|
:type find_current_highlight_color: str
|
|
102
|
-
:param find_current_text_color: The
|
|
102
|
+
:param find_current_text_color: The foreground colour of the current match selected by :py:func:`find_text()`.
|
|
103
103
|
:type find_current_text_color: str
|
|
104
|
-
:param selected_text_highlight_color: The
|
|
104
|
+
:param selected_text_highlight_color: The background colour of selected text.
|
|
105
105
|
:type selected_text_highlight_color: str
|
|
106
|
-
:param selected_text_color: The
|
|
106
|
+
:param selected_text_color: The foreground colour of selected text.
|
|
107
107
|
:type selected_text_color: str
|
|
108
108
|
|
|
109
109
|
Download behaviour:
|
|
@@ -1114,10 +1114,13 @@ class HtmlFrame(Frame):
|
|
|
1114
1114
|
|
|
1115
1115
|
def _handle_frame_resize(self, event):
|
|
1116
1116
|
# Tkhtml doesn't handle resizing outwards when shrink is enabled
|
|
1117
|
+
# Disabling text wrapping works great except that it has no effect on multiple inline text nodes in Tkhtml
|
|
1118
|
+
|
|
1117
1119
|
# When the widget resizes, resize it to the screen's width, and let it shrink back
|
|
1118
1120
|
# Otherwise, the widget will shrink when it can and return
|
|
1119
1121
|
# Not ideal, but still less ideal than the default behaviour
|
|
1120
1122
|
|
|
1123
|
+
### TODO: Needs improvement
|
|
1121
1124
|
### TODO: Fix from within Tkhtml???
|
|
1122
1125
|
|
|
1123
1126
|
if self.unshrink:
|
|
@@ -1386,7 +1389,7 @@ class HtmlLabel(HtmlFrame):
|
|
|
1386
1389
|
|
|
1387
1390
|
This widget also accepts one additional parameter:
|
|
1388
1391
|
|
|
1389
|
-
:param text: The HTML content of the widget
|
|
1392
|
+
:param text: The HTML or text content of the widget
|
|
1390
1393
|
:type text: str
|
|
1391
1394
|
|
|
1392
1395
|
By default the widget will be styled to match the :py:class:`ttk.Label` style. To change this, alter the ttk style or use CSS.
|
|
@@ -1468,23 +1471,23 @@ class HtmlText(HtmlFrame):
|
|
|
1468
1471
|
|
|
1469
1472
|
This widget accepts the following :py:class:`tk.Text` parameters:
|
|
1470
1473
|
|
|
1471
|
-
:param background:
|
|
1474
|
+
:param background: the widget's background colour
|
|
1472
1475
|
:type background: str
|
|
1473
|
-
:param foreground:
|
|
1476
|
+
:param foreground: the widget's foreground (text) colour
|
|
1474
1477
|
:type foreground: str
|
|
1475
|
-
:param selectbackground:
|
|
1478
|
+
:param selectbackground: the background colour of selected text
|
|
1476
1479
|
:type selectbackground: str
|
|
1477
|
-
:param selectforeground:
|
|
1480
|
+
:param selectforeground: the foreground colour of selected text
|
|
1478
1481
|
:type selectforeground: str
|
|
1479
|
-
:param insertontime:
|
|
1482
|
+
:param insertontime: the number of milliseconds the insertion cursor is visible
|
|
1480
1483
|
:type insertontime: int
|
|
1481
|
-
:param insertofftime:
|
|
1484
|
+
:param insertofftime: the number of milliseconds the insertion cursor is invisible
|
|
1482
1485
|
:type insertofftime: int
|
|
1483
|
-
:param insertwidth:
|
|
1486
|
+
:param insertwidth: the width of the insertion cursor in pixels
|
|
1484
1487
|
:type insertwidth: int
|
|
1485
|
-
:param insertbackground:
|
|
1488
|
+
:param insertbackground: the background colour of the insertion cursor
|
|
1486
1489
|
:type insertbackground: str
|
|
1487
|
-
:param state:
|
|
1490
|
+
:param state: the widget's state (``"normal"`` or ``"disabled"``)
|
|
1488
1491
|
:type state: str
|
|
1489
1492
|
|
|
1490
1493
|
Changed in version 4.15.
|
|
@@ -1931,7 +1934,7 @@ class HtmlText(HtmlFrame):
|
|
|
1931
1934
|
value = self._check_value(self._html.caret_manager.caret_width, kwargs.pop("insertwidth"))
|
|
1932
1935
|
self._html.caret_manager.caret_width = value
|
|
1933
1936
|
if "insertbackground" in kwargs:
|
|
1934
|
-
self._html.caret_manager.
|
|
1937
|
+
self._html.caret_manager.caret_color = kwargs.pop("insertbackground")
|
|
1935
1938
|
if "state" in kwargs:
|
|
1936
1939
|
state = kwargs.pop("state")
|
|
1937
1940
|
if state == "enabled":
|
|
@@ -1966,7 +1969,7 @@ class HtmlText(HtmlFrame):
|
|
|
1966
1969
|
elif "insertwidth" == key:
|
|
1967
1970
|
return self._html.caret_manager.caret_width
|
|
1968
1971
|
elif "insertbackground" == key:
|
|
1969
|
-
return self._html.caret_manager.
|
|
1972
|
+
return self._html.caret_manager.caret_color
|
|
1970
1973
|
elif "state" == key:
|
|
1971
1974
|
return "enabled" if self._html.caret_browsing_enabled else "disabled"
|
|
1972
1975
|
|
|
@@ -31,7 +31,7 @@ __title__ = "TkinterWeb"
|
|
|
31
31
|
__author__ = "Andrew Clarke"
|
|
32
32
|
__copyright__ = "(c) 2021-2025 Andrew Clarke"
|
|
33
33
|
__license__ = "MIT"
|
|
34
|
-
__version__ = "4.16.
|
|
34
|
+
__version__ = "4.16.9"
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
ROOT_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__)), "resources")
|
|
@@ -96,8 +96,7 @@ DEFAULT_STYLE = r"""
|
|
|
96
96
|
{ display: block }
|
|
97
97
|
HEAD, SCRIPT, TITLE { display: none }
|
|
98
98
|
BODY {
|
|
99
|
-
margin:8px;
|
|
100
|
-
white-space: nowrap;
|
|
99
|
+
margin: 8px;
|
|
101
100
|
}
|
|
102
101
|
/* Rules for lists */
|
|
103
102
|
LI { display: list-item }
|
|
@@ -448,7 +447,7 @@ INPUT[type="submit"],INPUT[type="button"], INPUT[type="reset"], BUTTON {
|
|
|
448
447
|
}
|
|
449
448
|
"""
|
|
450
449
|
|
|
451
|
-
SHRINK_STYLE = "BODY { white-space: nowrap }"
|
|
450
|
+
SHRINK_STYLE = "BODY { white-space: nowrap; }"
|
|
452
451
|
|
|
453
452
|
class BuiltinPageGenerator():
|
|
454
453
|
"""BUILTIN_PAGES used to be a dictionary of URIs and corresponding HTML code.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|