Tkinter button won't customize

I am making a simple game using python and Tkinter. Everything works well, but I cannot change the appearance of the only button in the game (the RESET button at the bottom). It should be flat and blue with white text to match the rest of the layout. This is the code I am using now:

resetbutton = Button(root, text='RESET', width=15, command=sw.Reset, highlightbackground="blue", relief='flat')
resetbutton.grid(column=5, columnspan=3, row=13, rowspan=1)

      

... but the button still looks like the default. Anyone have any ideas why this isn't working?

+3


source to share


2 answers


You can do as below: fg and bg (you can also assign fonts [if supported]):



Button(root, text='RESET', command=sw.Reset, font='Arial -20 bold', relief='flat', bg='blue', fg='white', width=10, height=2)

      

+1


source


, , , .

, resetbutton

:



  • activebackground="blue"

  • activeforeground= "white"

0









All Articles