wizard-tk-bridge 1.3__tar.gz → 1.4__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.
- {wizard_tk_bridge-1.3/wizard_tk_bridge.egg-info → wizard_tk_bridge-1.4}/PKG-INFO +5 -5
- {wizard_tk_bridge-1.3 → wizard_tk_bridge-1.4}/README_pypi.md +3 -3
- {wizard_tk_bridge-1.3 → wizard_tk_bridge-1.4}/setup.py +2 -2
- {wizard_tk_bridge-1.3 → wizard_tk_bridge-1.4}/src/wizard_tk_bridge/__init__.py +10 -1
- wizard_tk_bridge-1.4/src/wizard_tk_bridge/auto_scroll.py +226 -0
- {wizard_tk_bridge-1.3 → wizard_tk_bridge-1.4}/src/wizard_tk_bridge/wizard_form.py +5 -2
- {wizard_tk_bridge-1.3 → wizard_tk_bridge-1.4}/src/wizard_tk_bridge/wizard_table.py +4 -2
- {wizard_tk_bridge-1.3 → wizard_tk_bridge-1.4/wizard_tk_bridge.egg-info}/PKG-INFO +5 -5
- wizard_tk_bridge-1.4/wizard_tk_bridge.egg-info/requires.txt +1 -0
- wizard_tk_bridge-1.3/src/wizard_tk_bridge/auto_scroll.py +0 -37
- wizard_tk_bridge-1.3/wizard_tk_bridge.egg-info/requires.txt +0 -1
- {wizard_tk_bridge-1.3 → wizard_tk_bridge-1.4}/LICENSE.txt +0 -0
- {wizard_tk_bridge-1.3 → wizard_tk_bridge-1.4}/pyproject.toml +0 -0
- {wizard_tk_bridge-1.3 → wizard_tk_bridge-1.4}/setup.cfg +0 -0
- {wizard_tk_bridge-1.3 → wizard_tk_bridge-1.4}/src/wizard_tk_bridge/_no_text_io.py +0 -0
- {wizard_tk_bridge-1.3 → wizard_tk_bridge-1.4}/src/wizard_tk_bridge/close_binding.py +0 -0
- {wizard_tk_bridge-1.3 → wizard_tk_bridge-1.4}/src/wizard_tk_bridge/gui_style.py +0 -0
- {wizard_tk_bridge-1.3 → wizard_tk_bridge-1.4}/src/wizard_tk_bridge/py.typed +0 -0
- {wizard_tk_bridge-1.3 → wizard_tk_bridge-1.4}/src/wizard_tk_bridge/tk_bridge.py +0 -0
- {wizard_tk_bridge-1.3 → wizard_tk_bridge-1.4}/src/wizard_tk_bridge/wizard_calendar.py +0 -0
- {wizard_tk_bridge-1.3 → wizard_tk_bridge-1.4}/src/wizard_tk_bridge/wizard_path.py +0 -0
- {wizard_tk_bridge-1.3 → wizard_tk_bridge-1.4}/src/wizard_tk_bridge/wizard_pick_row.py +0 -0
- {wizard_tk_bridge-1.3 → wizard_tk_bridge-1.4}/src/wizard_tk_bridge/wizard_typed.py +0 -0
- {wizard_tk_bridge-1.3 → wizard_tk_bridge-1.4}/src/wizard_tk_bridge/wizard_window.py +0 -0
- {wizard_tk_bridge-1.3 → wizard_tk_bridge-1.4}/wizard_tk_bridge.egg-info/SOURCES.txt +0 -0
- {wizard_tk_bridge-1.3 → wizard_tk_bridge-1.4}/wizard_tk_bridge.egg-info/dependency_links.txt +0 -0
- {wizard_tk_bridge-1.3 → wizard_tk_bridge-1.4}/wizard_tk_bridge.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: wizard-tk-bridge
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.4
|
|
4
4
|
Summary: User interface Tk bridge for wizards asking a user questions.
|
|
5
5
|
Author: Tom Björkholm
|
|
6
6
|
Author-email: Tom Björkholm <klausuler_linnet0q@icloud.com>
|
|
@@ -18,7 +18,7 @@ Classifier: Typing :: Typed
|
|
|
18
18
|
Requires-Python: >=3.12
|
|
19
19
|
Description-Content-Type: text/markdown
|
|
20
20
|
License-File: LICENSE.txt
|
|
21
|
-
Requires-Dist: wizard-ui-bridge>=1.
|
|
21
|
+
Requires-Dist: wizard-ui-bridge>=1.4
|
|
22
22
|
Dynamic: author
|
|
23
23
|
Dynamic: license-file
|
|
24
24
|
Dynamic: requires-dist
|
|
@@ -203,10 +203,10 @@ MIT
|
|
|
203
203
|
|
|
204
204
|
## Test summary
|
|
205
205
|
|
|
206
|
-
- Test result:
|
|
206
|
+
- Test result: 1084 passed, 9 deselected in 45s
|
|
207
207
|
- No flake8 warnings.
|
|
208
208
|
- No mypy errors found.
|
|
209
209
|
- No pylint warnings.
|
|
210
210
|
- No python layout warnings.
|
|
211
|
-
- Built version(s): 1.
|
|
212
|
-
- Build and test using Python 3.14.
|
|
211
|
+
- Built version(s): 1.4
|
|
212
|
+
- Build and test using Python 3.14.7
|
|
@@ -177,10 +177,10 @@ MIT
|
|
|
177
177
|
|
|
178
178
|
## Test summary
|
|
179
179
|
|
|
180
|
-
- Test result:
|
|
180
|
+
- Test result: 1084 passed, 9 deselected in 45s
|
|
181
181
|
- No flake8 warnings.
|
|
182
182
|
- No mypy errors found.
|
|
183
183
|
- No pylint warnings.
|
|
184
184
|
- No python layout warnings.
|
|
185
|
-
- Built version(s): 1.
|
|
186
|
-
- Build and test using Python 3.14.
|
|
185
|
+
- Built version(s): 1.4
|
|
186
|
+
- Build and test using Python 3.14.7
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
from setuptools import setup # type: ignore[import-untyped]
|
|
5
5
|
|
|
6
6
|
setup(
|
|
7
|
-
name='wizard-tk-bridge', version='1.
|
|
7
|
+
name='wizard-tk-bridge', version='1.4',
|
|
8
8
|
description='User interface Tk bridge for wizards asking a user questions.',
|
|
9
9
|
author='Tom Björkholm', author_email='klausuler_linnet0q@icloud.com',
|
|
10
10
|
python_requires='>=3.12', packages=['wizard_tk_bridge'],
|
|
11
11
|
package_dir={'wizard_tk_bridge': 'src/wizard_tk_bridge'},
|
|
12
12
|
package_data={'wizard_tk_bridge': ['py.typed']},
|
|
13
13
|
install_requires=[
|
|
14
|
-
'wizard-ui-bridge >= 1.
|
|
14
|
+
'wizard-ui-bridge >= 1.4',
|
|
15
15
|
])
|
|
@@ -11,5 +11,14 @@ ways an application can show the wizard.
|
|
|
11
11
|
# MIT License
|
|
12
12
|
|
|
13
13
|
from wizard_tk_bridge.tk_bridge import WizardUiBridgeTk
|
|
14
|
+
from wizard_tk_bridge.auto_scroll import auto_hide, bind_wheel
|
|
15
|
+
from wizard_tk_bridge.close_binding import CLOSE_ACCELERATOR, bind_close
|
|
16
|
+
from wizard_tk_bridge.gui_style import style_input, focus_first_input
|
|
14
17
|
|
|
15
|
-
__all__ = ['WizardUiBridgeTk'
|
|
18
|
+
__all__ = ['WizardUiBridgeTk',
|
|
19
|
+
'auto_hide',
|
|
20
|
+
'bind_close',
|
|
21
|
+
'bind_wheel',
|
|
22
|
+
'CLOSE_ACCELERATOR',
|
|
23
|
+
'focus_first_input',
|
|
24
|
+
'style_input']
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
#! /usr/local/bin/python3
|
|
2
|
+
"""Scroll commands and wheel and touchpad support for an area.
|
|
3
|
+
|
|
4
|
+
A table that fits its area needs no scrollbar, and a scrollbar that is
|
|
5
|
+
always shown wastes space and hints at hidden content that is not there.
|
|
6
|
+
:func:`auto_hide` returns the scroll command for a scrolling widget: the
|
|
7
|
+
command hides the scrollbar while the whole range is visible and shows it
|
|
8
|
+
again once the widget grows past its area. It works for any widget that
|
|
9
|
+
reports its position through an ``xscrollcommand`` or ``yscrollcommand``,
|
|
10
|
+
so a wizard table's canvas and any other scrolling widget can share it.
|
|
11
|
+
|
|
12
|
+
Tk binds the mouse wheel and, from Tk 9 on, the touchpad on each of its
|
|
13
|
+
scrolling widgets, but binds neither on a canvas. A scrolling area built
|
|
14
|
+
from a canvas therefore answers a scroll only while the pointer is over
|
|
15
|
+
its scrollbar. :func:`bind_wheel` gives the area both over its content
|
|
16
|
+
as well.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
# Copyright (c) 2026 Tom Björkholm
|
|
20
|
+
# MIT License
|
|
21
|
+
|
|
22
|
+
import tkinter as tk
|
|
23
|
+
from functools import partial
|
|
24
|
+
from tkinter import ttk
|
|
25
|
+
from typing import Callable, Optional
|
|
26
|
+
from weakref import WeakSet
|
|
27
|
+
|
|
28
|
+
WHEEL_EVENTS = {'<MouseWheel>': 'y', '<Shift-MouseWheel>': 'x'}
|
|
29
|
+
X11_WHEEL_EVENTS = {'<Button-4>': 'y', '<Button-5>': 'y',
|
|
30
|
+
'<Shift-Button-4>': 'x', '<Shift-Button-5>': 'x'}
|
|
31
|
+
TOUCHPAD_EVENT = '<TouchpadScroll>'
|
|
32
|
+
NOTCH_DELTA = 120
|
|
33
|
+
BUTTON_DELTA = {4: NOTCH_DELTA, 5: -NOTCH_DELTA}
|
|
34
|
+
UNIT_DELTA = 40.0
|
|
35
|
+
STEP_HALF = 0x10000
|
|
36
|
+
SIGN_LIMIT = 0x8000
|
|
37
|
+
_SCROLL_AREAS: WeakSet[tk.Canvas] = WeakSet()
|
|
38
|
+
_WHEEL_WINDOWS: WeakSet[tk.Misc] = WeakSet()
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def auto_hide(scrollbar: ttk.Scrollbar
|
|
42
|
+
) -> Callable[[float | str, float | str], None]:
|
|
43
|
+
"""Return a scroll command that hides the scrollbar when it is full.
|
|
44
|
+
|
|
45
|
+
The result is used as a widget's ``xscrollcommand`` or
|
|
46
|
+
``yscrollcommand``. Tk reports the position as two fractions, which it
|
|
47
|
+
passes as strings, so the command accepts either a number or its
|
|
48
|
+
string form. The scrollbar must be laid out with the grid manager,
|
|
49
|
+
whose ``grid_remove`` remembers its cell across the hide.
|
|
50
|
+
"""
|
|
51
|
+
def command(first: float | str, last: float | str) -> None:
|
|
52
|
+
"""Hide or show the scrollbar, then move its thumb to the view."""
|
|
53
|
+
if float(first) <= 0.0 and float(last) >= 1.0:
|
|
54
|
+
scrollbar.grid_remove()
|
|
55
|
+
else:
|
|
56
|
+
scrollbar.grid()
|
|
57
|
+
scrollbar.set(first, last)
|
|
58
|
+
return command
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def bind_wheel(canvas: tk.Canvas) -> None:
|
|
62
|
+
"""Let the wheel and the touchpad scroll this canvas from its content.
|
|
63
|
+
|
|
64
|
+
The binding sits on the window that holds the canvas, and not on the
|
|
65
|
+
canvas and the widgets inside it, because those widgets are built and
|
|
66
|
+
rebuilt while the user works. The window's handler then finds the
|
|
67
|
+
area from the widget the scroll reached, so a single binding per
|
|
68
|
+
window serves every area in it.
|
|
69
|
+
|
|
70
|
+
A touchpad is bound separately from a wheel, as Tk 9 reports the two
|
|
71
|
+
as different events, and only Tk 9 knows the touchpad one at all.
|
|
72
|
+
"""
|
|
73
|
+
_SCROLL_AREAS.add(canvas)
|
|
74
|
+
window = canvas.winfo_toplevel()
|
|
75
|
+
if window in _WHEEL_WINDOWS:
|
|
76
|
+
return
|
|
77
|
+
_WHEEL_WINDOWS.add(window)
|
|
78
|
+
for sequence, axis in _wheel_events(window).items():
|
|
79
|
+
window.bind(sequence, partial(_on_wheel, window, axis), add='+')
|
|
80
|
+
if tk.TkVersion >= 9.0:
|
|
81
|
+
window.bind(TOUCHPAD_EVENT, partial(_on_touchpad, window), add='+')
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def _wheel_events(window: tk.Misc) -> dict[str, str]:
|
|
85
|
+
"""Return the wheel sequences to bind, each with the axis it moves.
|
|
86
|
+
|
|
87
|
+
X11 with Tk 8.6 has no wheel event: it presses button 4 and button 5
|
|
88
|
+
instead, and the same buttons with shift held for the sideways
|
|
89
|
+
wheel. Every other windowing system, and Tk 9 on all of them, sends
|
|
90
|
+
a MouseWheel event, and binding those buttons there would answer the
|
|
91
|
+
side buttons of a mouse instead.
|
|
92
|
+
"""
|
|
93
|
+
if window.tk.call('tk', 'windowingsystem') == 'x11':
|
|
94
|
+
return {**WHEEL_EVENTS, **X11_WHEEL_EVENTS}
|
|
95
|
+
return WHEEL_EVENTS
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def _on_wheel(window: tk.Misc, axis: str, event: 'tk.Event[tk.Misc]') -> None:
|
|
99
|
+
"""Scroll the area the wheel belongs to along the event's axis."""
|
|
100
|
+
area = _event_area(window, event, axis)
|
|
101
|
+
if area is not None:
|
|
102
|
+
_scroll(area, axis, _wheel_delta(event))
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def _on_touchpad(window: tk.Misc, event: 'tk.Event[tk.Misc]') -> None:
|
|
106
|
+
"""Scroll the area a touchpad gesture belongs to, both ways at once.
|
|
107
|
+
|
|
108
|
+
A touchpad gesture moves the view whichever way the fingers went, so
|
|
109
|
+
its event carries a sideways and a downward step together and needs
|
|
110
|
+
no shift key for the sideways one. The steps are pixels, which the
|
|
111
|
+
canvas moves by the same way it does under a dragging hand.
|
|
112
|
+
"""
|
|
113
|
+
sideways, downward = _touchpad_steps(window, event.delta)
|
|
114
|
+
axis = 'y' if abs(downward) >= abs(sideways) else 'x'
|
|
115
|
+
area = _event_area(window, event, axis)
|
|
116
|
+
if area is not None:
|
|
117
|
+
area.scan_mark(0, 0)
|
|
118
|
+
area.scan_dragto(sideways, downward, gain=1)
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def _event_area(window: tk.Misc, event: 'tk.Event[tk.Misc]',
|
|
122
|
+
axis: str) -> Optional[tk.Canvas]:
|
|
123
|
+
"""Return the area one scroll event moves along the axis, if any."""
|
|
124
|
+
target = _scroll_widget(window, event)
|
|
125
|
+
if target is None or _own_wheel(target, axis):
|
|
126
|
+
return None
|
|
127
|
+
return _wheel_area(target)
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
def _scroll_widget(window: tk.Misc,
|
|
131
|
+
event: 'tk.Event[tk.Misc]') -> Optional[tk.Misc]:
|
|
132
|
+
"""Return the widget one scroll event belongs to, if it is in an area.
|
|
133
|
+
|
|
134
|
+
Tk sends the event to the widget under the pointer, which is what
|
|
135
|
+
every scrolling widget of its own goes by, so the widget the event
|
|
136
|
+
reached is tried first. Tk 8.6 on Windows instead sends the wheel to
|
|
137
|
+
the focused widget, and looking the pointer position up then catches
|
|
138
|
+
the case where the focus is outside every area.
|
|
139
|
+
"""
|
|
140
|
+
widget = event.widget
|
|
141
|
+
if isinstance(widget, tk.Misc) and _wheel_area(widget) is not None:
|
|
142
|
+
return widget
|
|
143
|
+
under_pointer = window.winfo_containing(event.x_root, event.y_root)
|
|
144
|
+
if under_pointer is not None and _wheel_area(under_pointer) is not None:
|
|
145
|
+
return under_pointer
|
|
146
|
+
return None
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
def _wheel_area(widget: tk.Misc) -> Optional[tk.Canvas]:
|
|
150
|
+
"""Return the scrolling area the widget is in, if it is in one."""
|
|
151
|
+
while True:
|
|
152
|
+
if isinstance(widget, tk.Canvas) and widget in _SCROLL_AREAS:
|
|
153
|
+
return widget
|
|
154
|
+
parent = widget.winfo_parent()
|
|
155
|
+
if not parent:
|
|
156
|
+
return None
|
|
157
|
+
widget = widget.nametowidget(parent)
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
def _own_wheel(widget: tk.Misc, axis: str) -> bool:
|
|
161
|
+
"""Return whether the widget answers the mouse wheel itself.
|
|
162
|
+
|
|
163
|
+
A combobox steps through its values on the wheel, and a list or a
|
|
164
|
+
text scrolls its own view while it holds more than it shows. The
|
|
165
|
+
wheel then belongs to the widget and not to the area around it, and
|
|
166
|
+
a list that shows all it holds leaves the wheel to the area.
|
|
167
|
+
"""
|
|
168
|
+
if isinstance(widget, ttk.Combobox):
|
|
169
|
+
return True
|
|
170
|
+
if not isinstance(widget, (tk.Listbox, tk.Text)):
|
|
171
|
+
return False
|
|
172
|
+
view = widget.yview() if axis == 'y' else widget.xview()
|
|
173
|
+
return float(view[0]) > 0.0 or float(view[1]) < 1.0
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
def _wheel_delta(event: 'tk.Event[tk.Misc]') -> int:
|
|
177
|
+
"""Return the wheel delta, also for X11's wheel button presses.
|
|
178
|
+
|
|
179
|
+
X11 with Tk 8.6 has no delta to report: it presses button 4 for one
|
|
180
|
+
notch up and button 5 for one notch down, which the delta of a whole
|
|
181
|
+
notch stands for here. A wheel event carries no button number at
|
|
182
|
+
all, which is why the number is looked up rather than tested.
|
|
183
|
+
"""
|
|
184
|
+
return BUTTON_DELTA.get(event.num, event.delta)
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
def _touchpad_steps(widget: tk.Misc, delta: int) -> tuple[int, int]:
|
|
188
|
+
"""Return the sideways and downward pixels of one touchpad event.
|
|
189
|
+
|
|
190
|
+
Tk packs both steps of the gesture into the one delta a scroll event
|
|
191
|
+
carries, the sideways step in its high half and the downward one, as
|
|
192
|
+
a signed number, in its low half. The steps are points, which Tk's
|
|
193
|
+
own scrolling widgets turn into pixels for the display in use, and
|
|
194
|
+
``tk::ScaleNum`` is the very conversion those widgets apply.
|
|
195
|
+
"""
|
|
196
|
+
sideways = delta >> 16
|
|
197
|
+
low = delta & (STEP_HALF - 1)
|
|
198
|
+
downward = low if low < SIGN_LIMIT else low - STEP_HALF
|
|
199
|
+
return (int(widget.tk.call('tk::ScaleNum', sideways)),
|
|
200
|
+
int(widget.tk.call('tk::ScaleNum', downward)))
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
def _scroll(area: tk.Canvas, axis: str, delta: int) -> None:
|
|
204
|
+
"""Scroll the area one wheel step along the axis.
|
|
205
|
+
|
|
206
|
+
From Tk 9 on the step can be a fraction of a unit, which the finer
|
|
207
|
+
steps of a trackpad give, so the amount goes to Tk as it is instead
|
|
208
|
+
of through the whole-unit ``xview_scroll`` and ``yview_scroll``.
|
|
209
|
+
"""
|
|
210
|
+
area.tk.call(str(area), f'{axis}view', 'scroll',
|
|
211
|
+
_wheel_amount(area, delta), 'units')
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
def _wheel_amount(widget: tk.Misc, delta: int) -> float:
|
|
215
|
+
"""Return the units one wheel event scrolls, as a scrollbar does.
|
|
216
|
+
|
|
217
|
+
From Tk 9 on every windowing system reports 120 for one notch of the
|
|
218
|
+
wheel, and Tk's own scrollbars scroll three units for it, taking a
|
|
219
|
+
fraction of a unit for the finer steps of a trackpad. Tk 8.6 scrolls
|
|
220
|
+
one whole unit per notch, and reports that notch as 1 on macOS and
|
|
221
|
+
as 120 on the other windowing systems.
|
|
222
|
+
"""
|
|
223
|
+
if tk.TkVersion >= 9.0:
|
|
224
|
+
return -delta / UNIT_DELTA
|
|
225
|
+
aqua = widget.tk.call('tk', 'windowingsystem') == 'aqua'
|
|
226
|
+
return int(-delta / (1 if aqua else NOTCH_DELTA))
|
|
@@ -35,7 +35,7 @@ from wizard_ui_bridge.bridge_helpers import INT_ERROR as _INT_ERROR, \
|
|
|
35
35
|
int_text, multi_count_message, out_of_range, path_answer, range_error, \
|
|
36
36
|
text_answer
|
|
37
37
|
from wizard_ui_bridge.form_helpers import valid_prefills
|
|
38
|
-
from wizard_tk_bridge.auto_scroll import auto_hide
|
|
38
|
+
from wizard_tk_bridge.auto_scroll import auto_hide, bind_wheel
|
|
39
39
|
from wizard_tk_bridge.gui_style import style_input
|
|
40
40
|
from wizard_tk_bridge.wizard_path import PathRow
|
|
41
41
|
from wizard_tk_bridge.wizard_pick_row import HintEntry, PickRow, TypedInput
|
|
@@ -491,7 +491,9 @@ class FormEditor:
|
|
|
491
491
|
A tall form (many rows) would overflow the fixed-size wizard
|
|
492
492
|
window, so the labelled rows sit in a frame inside a vertically
|
|
493
493
|
scrolling canvas whose scrollbar appears only when it is needed.
|
|
494
|
-
The
|
|
494
|
+
The mouse wheel scrolls the area from over the rows as well, which
|
|
495
|
+
Tk gives the scrollbar alone. The status line stays below the
|
|
496
|
+
scroll area so it is always shown.
|
|
495
497
|
"""
|
|
496
498
|
outer = tk.Frame(parent)
|
|
497
499
|
outer.pack(fill='both', expand=True, pady=6)
|
|
@@ -502,6 +504,7 @@ class FormEditor:
|
|
|
502
504
|
canvas.configure(yscrollcommand=auto_hide(vbar))
|
|
503
505
|
canvas.grid(row=0, column=0, sticky='nsew')
|
|
504
506
|
vbar.grid(row=0, column=1, sticky='ns')
|
|
507
|
+
bind_wheel(canvas)
|
|
505
508
|
grid = tk.Frame(canvas)
|
|
506
509
|
canvas.create_window((0, 0), window=grid, anchor='nw')
|
|
507
510
|
grid.bind('<Configure>', lambda _event: canvas.configure(
|
|
@@ -19,7 +19,7 @@ from dataclasses import dataclass
|
|
|
19
19
|
from tkinter import ttk
|
|
20
20
|
from typing import Optional, Sequence, TypeVar
|
|
21
21
|
from wizard_ui_bridge import PartialCheck, TableCell, TableColumn
|
|
22
|
-
from wizard_tk_bridge.auto_scroll import auto_hide
|
|
22
|
+
from wizard_tk_bridge.auto_scroll import auto_hide, bind_wheel
|
|
23
23
|
from wizard_tk_bridge.gui_style import style_input
|
|
24
24
|
|
|
25
25
|
WRAP_LENGTH = 520
|
|
@@ -148,7 +148,8 @@ class TableEditor:
|
|
|
148
148
|
Every table scrolls horizontally through an auto-hiding scrollbar
|
|
149
149
|
so a table wider than the window stays reachable. A variable table
|
|
150
150
|
also scrolls vertically within a fixed height, while a fixed table
|
|
151
|
-
grows to show all of its rows.
|
|
151
|
+
grows to show all of its rows. The mouse wheel scrolls the area
|
|
152
|
+
from over the cells too, sideways with shift held.
|
|
152
153
|
"""
|
|
153
154
|
box = tk.Frame(parent)
|
|
154
155
|
self._pack_box(box)
|
|
@@ -157,6 +158,7 @@ class TableEditor:
|
|
|
157
158
|
canvas.configure(xscrollcommand=auto_hide(hbar))
|
|
158
159
|
canvas.grid(row=0, column=0, sticky='nsew')
|
|
159
160
|
hbar.grid(row=1, column=0, sticky='ew')
|
|
161
|
+
bind_wheel(canvas)
|
|
160
162
|
self._add_vertical(box, canvas)
|
|
161
163
|
box.rowconfigure(0, weight=1)
|
|
162
164
|
box.columnconfigure(0, weight=1)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: wizard-tk-bridge
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.4
|
|
4
4
|
Summary: User interface Tk bridge for wizards asking a user questions.
|
|
5
5
|
Author: Tom Björkholm
|
|
6
6
|
Author-email: Tom Björkholm <klausuler_linnet0q@icloud.com>
|
|
@@ -18,7 +18,7 @@ Classifier: Typing :: Typed
|
|
|
18
18
|
Requires-Python: >=3.12
|
|
19
19
|
Description-Content-Type: text/markdown
|
|
20
20
|
License-File: LICENSE.txt
|
|
21
|
-
Requires-Dist: wizard-ui-bridge>=1.
|
|
21
|
+
Requires-Dist: wizard-ui-bridge>=1.4
|
|
22
22
|
Dynamic: author
|
|
23
23
|
Dynamic: license-file
|
|
24
24
|
Dynamic: requires-dist
|
|
@@ -203,10 +203,10 @@ MIT
|
|
|
203
203
|
|
|
204
204
|
## Test summary
|
|
205
205
|
|
|
206
|
-
- Test result:
|
|
206
|
+
- Test result: 1084 passed, 9 deselected in 45s
|
|
207
207
|
- No flake8 warnings.
|
|
208
208
|
- No mypy errors found.
|
|
209
209
|
- No pylint warnings.
|
|
210
210
|
- No python layout warnings.
|
|
211
|
-
- Built version(s): 1.
|
|
212
|
-
- Build and test using Python 3.14.
|
|
211
|
+
- Built version(s): 1.4
|
|
212
|
+
- Build and test using Python 3.14.7
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
wizard-ui-bridge>=1.4
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
#! /usr/local/bin/python3
|
|
2
|
-
"""A scroll command that shows a scrollbar only while it can scroll.
|
|
3
|
-
|
|
4
|
-
A table that fits its area needs no scrollbar, and a scrollbar that is
|
|
5
|
-
always shown wastes space and hints at hidden content that is not there.
|
|
6
|
-
:func:`auto_hide` returns the scroll command for a scrolling widget: the
|
|
7
|
-
command hides the scrollbar while the whole range is visible and shows it
|
|
8
|
-
again once the widget grows past its area. It works for any widget that
|
|
9
|
-
reports its position through an ``xscrollcommand`` or ``yscrollcommand``,
|
|
10
|
-
so a wizard table's canvas and any other scrolling widget can share it.
|
|
11
|
-
"""
|
|
12
|
-
|
|
13
|
-
# Copyright (c) 2026 Tom Björkholm
|
|
14
|
-
# MIT License
|
|
15
|
-
|
|
16
|
-
from tkinter import ttk
|
|
17
|
-
from typing import Callable
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
def auto_hide(scrollbar: ttk.Scrollbar
|
|
21
|
-
) -> Callable[[float | str, float | str], None]:
|
|
22
|
-
"""Return a scroll command that hides the scrollbar when it is full.
|
|
23
|
-
|
|
24
|
-
The result is used as a widget's ``xscrollcommand`` or
|
|
25
|
-
``yscrollcommand``. Tk reports the position as two fractions, which it
|
|
26
|
-
passes as strings, so the command accepts either a number or its
|
|
27
|
-
string form. The scrollbar must be laid out with the grid manager,
|
|
28
|
-
whose ``grid_remove`` remembers its cell across the hide.
|
|
29
|
-
"""
|
|
30
|
-
def command(first: float | str, last: float | str) -> None:
|
|
31
|
-
"""Hide or show the scrollbar, then move its thumb to the view."""
|
|
32
|
-
if float(first) <= 0.0 and float(last) >= 1.0:
|
|
33
|
-
scrollbar.grid_remove()
|
|
34
|
-
else:
|
|
35
|
-
scrollbar.grid()
|
|
36
|
-
scrollbar.set(first, last)
|
|
37
|
-
return command
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
wizard-ui-bridge>=1.3
|
|
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
|
{wizard_tk_bridge-1.3 → wizard_tk_bridge-1.4}/wizard_tk_bridge.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|