I noticed the read only state on entries is not graphically represented as in stock tkinter, where the background is turned grey.
An editable entry looks just the same as a not-editable one.
Is there a quick fix for this?
Here is an example app to showcase the issue.
Just # the two root.tk.call lines to see the expected behaviour without the theme.
import tkinter as tk
from tkinter import ttk
class App(ttk.Frame):
def __init__(self, parent):
ttk.Frame.__init__(self)
# Create widgets :)
self.setup_widgets()
def setup_widgets(self):
# Create a Frame for the Checkbuttons
self.check_frame = ttk.LabelFrame(self, text="Checkbuttons", padding=(20, 10))
self.check_frame.grid(
row=0, column=0, padx=(20, 10), pady=(20, 10), sticky="nsew"
)
# Create a Frame for input widgets
self.widgets_frame = ttk.Frame(self, padding=(0, 0, 0, 10))
self.widgets_frame.grid(
row=0, column=1, padx=10, pady=(30, 10), sticky="nsew", rowspan=3
)
# Entry
self.entry = ttk.Entry(self.widgets_frame)
self.entry.insert(0, "Entry editable")
self.entry.config(state="write")
self.entry.grid(row=0, column=0, padx=5, pady=(0, 10), sticky="ew")
self.entry2 = ttk.Entry(self.widgets_frame)
self.entry2.insert(0, "Not editable")
self.entry2.config(state="readonly")
self.entry2.grid(row=0, column=1, padx=5, pady=(0, 10), sticky="ew")
if __name__ == "__main__":
root = tk.Tk()
root.title("")
# Simply set the theme
root.tk.call("source", "azure.tcl")
root.tk.call("set_theme", "dark")
app = App(root)
app.pack(fill="both", expand=True)
# Set a minsize for the window, and place it in the middle
root.update()
root.minsize(root.winfo_width(), root.winfo_height())
x_cordinate = int((root.winfo_screenwidth() / 2) - (root.winfo_width() / 2))
y_cordinate = int((root.winfo_screenheight() / 2) - (root.winfo_height() / 2))
root.geometry("+{}+{}".format(x_cordinate, y_cordinate-20))
root.mainloop()