Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to add background and font color to widget in tkinter

# you can either use the regular color name or HEX value

pword_label = Label(text='Password', font=('calibre', 10, 'bold'), bg='black', fg='white')
pword_label.grid(row=3, column=0, pady=(10, 10))

# bg sets the background color
# while fg which means fore-ground color sets the font color
pword_entry = Entry(width=36, bg='green')
pword_entry.grid(row=3, column=1)

generate_btn = Button(text='Generate Password', bg='#E2D784')
generate_btn.grid(row=3, column=2)

save_btn = Button(text='save', width=36, bg='#006778', font=('Courier', 10, 'bold'), fg='white')
save_btn.grid(row=4, column=1, columnspan=2)
 
PREVIOUS NEXT
Tagged: #add #background #font #color #widget #tkinter
ADD COMMENT
Topic
Name
4+9 =