ttkbootstrap库如何禁用滚动文本框的编辑模式?
不管是showtag_text2.config(state=DISABLED),或者configure(),都会报错:
以下回答参考GPT并且由Bony-整理:
错误提示,可能是ttkbootstrap库的文本框控件并没有提供-state选项,导致在禁用编辑状态时出错。可以尝试使用其他可用的选项来实现禁用编辑状态。
在ttkbootstrap中,文本框控件的选项包括:
background
borderwidth
cursor
exportselection
font
foreground
height
highlightbackground
highlightcolor
highlightthickness
insertbackground
insertborderwidth
insertofftime
insertontime
insertwidth
justify
padx
pady
relief
selectbackground
selectborderwidth
selectforeground
spacing1
以下回答参考GPT并且由Bony-整理:
spacing2
spacing3
state
takefocus
textvariable
width
xscrollcommand
yscrollcommand
可以尝试使用其中的一些选项,如takefocus或者state来实现禁用编辑状态,例如:
showtag_text2 = ttk.Text(outer_frame, font=("",10), height=4, wrap='word')
showtag_text2.configure(state='disabled', takefocus=0)
或者使用config方法:
showtag_text2 = ttk.Text(outer_frame, font=("",10), height=4, wrap='word')
showtag_text2.config(state='disabled', takefocus=0)
注意:以上代码可能需要根据实际情况进行修改,如控件的名称和选项的名称。