'Is there a way to make Entry widgets in tkinter rounded or look nicer?
I code in Python and I use tkinter quite a lot to create GUIs for my applications. I prefer to make my GUIs look round and modern rather than sharp cornered boxes. For buttons and labels I tend to use PhotoImage to use self-made images that provide a cleaner look.
My GUIs look really modern now but the only issue is that I have Entry widgets for users to enter data. They still look really boxy and rectangular, which makes them stand out from the rest of the modern look. My question is, that is there a method in tkinter like PhotoImage, that makes the Entry Widget look better?
This is the current way I make entry widgets:
from tkinter import *
root = Tk()
e = Entry(root)
e.pack()
root.mainloop()
When I say make entries look nicer I mean:
- Smoother Corners
- Rounded Edges
- Just a less boxy look
I hope someone can help me.
Thanks
Solution 1:[1]
U can place ur sharp corner image & place your tkinter entry on it , sure to add entry bg color same as images color.
import tkinter as tk
root = tk.Tk()
#read image for entry
entry_bg_image=PhotoImage(
file=r"file.extension")
#add frame for entry
entry_frame = tk.Frame(root)
entry_frame.pack()
#place your rounded corner image.
#for entry bg
entry_bg =tk.Label(entry_frame,
image=entry_bg_image)
entry_bg.place(rely=0 ,relx=0)
#place entry
entry = tk.Entry(entry_frame
,bg=same_as_image)
entry.place(relx=0,rely=0)
root.mainloop()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Thisal |