israel-dryer / ttkbootstrap

A supercharged theme extension for tkinter that enables on-demand modern flat style themes inspired by Bootstrap.
MIT License
1.78k stars 358 forks source link

ScrolledText widget can't press Ctrl+A #543

Open peterju opened 4 months ago

peterju commented 4 months ago

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

dphdmn commented 1 month ago

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.