0

In the program, I specified the buttons' text to have color, but they aways show up black, and I never get an error message.

Here's my code:

from Tkinter import *

root = Tk()

topFrame = Frame(root)
topFrame.pack()
bottomFrame = Frame(root)
bottomFrame.pack(side = BOTTOM)

button1 = Button(topFrame,text = "Button 1",fg = "red")
button2 = Button(topFrame,text = "Button 2",fg = "green")
button3 = Button(topFrame,text = "Button 3",fg = "blue")
button4 = Button(bottomFrame,text = "Button 4",fg = "purple")

button1.pack(side = LEFT)
button2.pack(side = LEFT)
button3.pack(side = LEFT)
button4.pack(side = BOTTOM)

root.mainloop()
  • 1
    What platform? On some (such as Mac), Tk uses native widgets where possible, which don't necessarily support all of the normal configuration options. https://stackoverflow.com/questions/1529847/how-to-change-the-foreground-or-background-colour-of-a-tkinter-button-on-mac-os has some alternatives. – jasonharper May 28 '17 at 00:13
  • What Python version and what platform are you using? – zwer May 28 '17 at 00:13
  • I use mac, and the python version is 3.6.1 (not sure, but definitely python 3 or above) – HelloPeople99 May 31 '17 at 04:13

0 Answers0