Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ScrolledText widget can't press Ctrl+A #543

Open
peterju opened this issue Feb 27, 2024 · 1 comment
Open

ScrolledText widget can't press Ctrl+A #543

peterju opened this issue Feb 27, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@peterju
Copy link

peterju commented Feb 27, 2024

Desktop (please complete the following information):

ttkbootstrap Version 1.10.1

Describe the bug

When press Ctrl+A on ScrolledText , the bug is below

File "d:\pyTest\urlchecker\env\Lib\site-packages\ttkbootstrap\window.py", line 109, in on_select_all
widget.select_range(0, END)
^^^^^^^^^^^^^^^^^^^
AttributeError: 'ScrolledText' object has no attribute 'select_range'

To Reproduce

press Ctrl+A on ScrolledText widget

Expected behavior

Maybe change:
if widget.class.name == "Text":
to:
if widget.class.name in ("Text",'ScrolledText'):

Screenshots

No response

Additional context

No response

@peterju peterju added the bug Something isn't working label Feb 27, 2024
@dphdmn
Copy link

dphdmn commented May 11, 2024

Same here. Possible workaround - just using Text widget instead and attach scrollbar to it.

textbox = ttk.Text(master=frame)
textbox.pack(side=tk.LEFT, fill=tk.BOTH, expand=True)

yscrollbar = Scrollbar(frame, orient="vertical", bootstyle="info", command=textbox.yview)
yscrollbar.pack(expand=False, fill=Y, side="right")
textbox.configure(yscrollcommand=yscrollbar.set)

In this code
command=textbox.yview is used to make scrollbar affect the Text widget.
yscrollcommand=yscrollbar.set is used to make Text widget affect scrollbar, making the full connection.

(Now a bit off-topic, but as I have noticed, the issues with scrollbars is the common theme of ttkbootstrap)
Same simple solution could be used to fix TableView widget, which lacks the vertical scrollbar for some reason by the default, but you would have to use tableview.view.yview in command option to get the TreeView widget object inside of it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants