Replace the tk.Scrollbar inside a ScrolledText with a ttk.Scrollbar. macOS native rendering ignores color options on tk.Scrollbar, so we swap it out for a ttk.Scrollbar which respects the clam theme styles.
(st: scrolledtext.ScrolledText, style: str)
| 151 | |
| 152 | |
| 153 | def _replace_scrollbar(st: scrolledtext.ScrolledText, style: str) -> None: |
| 154 | """Replace the tk.Scrollbar inside a ScrolledText with a ttk.Scrollbar. |
| 155 | |
| 156 | macOS native rendering ignores color options on tk.Scrollbar, so we |
| 157 | swap it out for a ttk.Scrollbar which respects the clam theme styles. |
| 158 | """ |
| 159 | old = st.vbar |
| 160 | new = ttk.Scrollbar(st.frame, orient=tk.VERTICAL, style=style, command=st.yview) |
| 161 | new.pack(side=tk.RIGHT, fill=tk.Y) |
| 162 | old.pack_forget() |
| 163 | old.destroy() |
| 164 | st.vbar = new |
| 165 | st.configure(yscrollcommand=new.set) |
| 166 | |
| 167 | |
| 168 | class MessagePanel(ttk.Frame): |