My task is to create a label and button on Tkinter. The button has to change the label, and I have to change the colour of the button and the label. I have changed the colour of
On Windows 10, I have run into the same problem, and have found a solution, although not a very satisfying one. The following will create a black button with white foreground type:
First define a custom button style based on the standard TButton style
mystyle = ttk.Style()
mystyle.configure('mycustom.TButton',background='black',foreground='white')
Then create the button using the new custom style
mybutton = ttk.Button(root,style='mycustom.Tbutton')
I say 'not very satisfying' because this only works if I have previously set the overall theme to 'default' as follows:
mystyle = ttk.Style()
mystyle.theme_use('default')
Using any of the other themes available on my system (winnative,clam,alt,classic,vista and xpnative) will change only the border to black, and leave the background grey.