Python: Tkinter widget background (buttons, records, etc.)

I had a little problem creating my GUI. When changing the background, I can change the whole background, as well as the background of shortcuts, etc., But when it comes to buttons and input fields, etc., there is a white area behind the button that I can not change: S

The problem is shown in the figure below.

(There is not enough reputation to publish the image, so I will link it) http://www.thesite.dk/upload/media/tkinter.png

With code:

from Tkinter import *

background = "BLACK"
textColor = "WHITE"
root = Tk()
root.configure(bg=background)

Email = Label(root, text="Enter E-mail Address :", font=("Lucida Grande", 12), fg=textColor, background=background)
Email.grid(row=6, column=0, sticky=NW, padx=19)

EmailField = Entry(root, width=30)
EmailField.grid(row=6, column=0, columnspan=3, sticky=NW, padx=159)

EmailButton = Button(root, text="Mail It !", background=background)
EmailButton.grid(row=6, column=0, columnspan=6, sticky=NW, padx=389)

SM_Status = StringVar()
EmailStatus = Label(root, textvariable=SM_Status, font=("Lucida Grande", 12), fg=textColor, background=background)
EmailStatus.grid(row=6, column=2, sticky=NW, padx=20)

It may be a simple solution, but countless search queries and forum posts and forum posts will not go anywhere :( I hope you can help ...

And yes, I am using Mac OS X with python 2.6

+5
source share
3

, , , , , , , . , , :

highlightbackground=color

+10

. , . , , , " ", highlightbackground highlightthickness . , .

+2

, -, , , . , Mac , . , , . , Tkinter.

On Windows with a classic theme, the button background is black, but there is a gray outline due to the elevated relief. When I set it to reset = FLAT, it is completely black.

It would be helpful if your included sample was directly launched. I had to add a definition for textColor, comment out the = CMD.send_mail command and add root.mainloop () at the end. I also added textColor = WHITE to the button setting.

Try playing with the reset option or change the system theme to see if you can influence how the button is drawn.

+1
source

All Articles