Tkinter: style ttk.Entry widget when selected

Viewed 26

This is the code I'm using to costumize the tkinter Entry:

import tkinter as tk
from tkinter import ttk

class MainApplication(tk.Frame):
    def __init__(self, parent, *args, **kwargs):
        tk.Frame.__init__(self, parent, *args, **kwargs)

        style = ttk.Style()
        style.theme_use('clam')
        style.configure('TLabelframe', background='#ffffff', bordercolor='black')
        style.configure('TEntry', bordercolor='black')
        style.map('TEntry', lightcolor=[('focus', 'red')])

        frame = ttk.LabelFrame(root)
        frame.pack(side="top", padx=20, pady=20, ipadx=20, ipady=20)

        entry = ttk.Entry(frame)
        entry.grid(row=1, column=0, ipady=5, padx=20, pady=20)

if __name__ == "__main__":
    root = tk.Tk()
    root.configure(bg='#ffffff')
    MainApplication(root).pack(side="top", fill="both", expand=True)
    root.mainloop()

This is the result: enter image description here

Is it possible to change the color around the red (right now it seems kinda blueish)?

Also whats is and how can I delete the gray block indicated by the red arrow?

enter image description here

0 Answers
Related