1

I have been making a cmd (Windows) clone with tkinter, so far mostly cosmetically. The issue is with the cosmetic options for the scrollbar, which do not seem to be applying. I'm at a loss.

root.title(f"{USER}: Windows Interpreter")
root.iconphoto(True , ICON_PHOTO)
root.resizable(0 , 0)

scrollbar = tk.Scrollbar(root)
scrollbar.config(orient = "vertical" , activebackground = BLACK , bg = BLACK , troughcolor = BLACK)
scrollbar.grid(row = 0 , column = 1 , sticky = "ns")

text = tk.Text(root , width = 120 , height = 30 , bg = BLACK , bd = 0 , font = FONT , fg = OFFWHITE , selectbackground = WHITE , selectforeground = BLACK , insertbackground = WHITE , insertwidth = 8 , wrap = "char")
text.grid(row = 0 , column = 0)

scrollbar.config(command = text.yview)
text.config(yscrollcommand = scrollbar.set)

This is the relevant part of the code, the scrollbar.config() line that is full of options is doing nothing as far as I can tell.

Cresht
  • 1,020
  • 2
  • 6
  • 15
  • Have you defined a value for the constant `BLACK`? I think python 2 allowed arguments like that, but for python 3 at least you need to use a string if you haven't already defined `BLACK`. – dwb May 18 '20 at 07:51
  • yes, sorry I could have mentioned that. BLACK, WHITE, and OFFWHITE are all valid strings for colors in hexadecimal. ("#000000" , "#ffffff" , "#d6d6d6") – Cresht May 18 '20 at 15:03
  • The Scrollbar Cosmetic Options aren't working because they're getting their theme from Windows. One option would be to change your Windows theme but that's not a very good one. I recommend looking at this question https://stackoverflow.com/questions/43836557/other-option-for-colored-scrollbar-in-tkinter-based-program. – TeaCoast Sep 01 '20 at 00:27
  • TeaCoast is right, the windows theme is not fully customizable. As an alternative, you can use a `ttk.Scrollbar` and change the theme to 'alt' or 'clam' to be able to change the scrollbar colors with a `ttk.Style` – j_4321 Sep 01 '20 at 11:47

0 Answers0