user7450368
user7450368

Reputation:

Grey border around tkinter widgets (not using canvas)

I am experiencing issues with a Python 3 tkinter program I'm working on.

I am running macOS Sierra.

When running the app, every widget has a grey border around it.

Is there any way to remove this?

Screenshot of the border:

A screenshot showing 3 widgets, each with a border

Here's the code:

# Item list
itemlist=Treeview(root)
itemlist.heading("#0", text="Item Name")
itemlist["columns"]=("1")
itemlist.column("1",width=50)
itemlist.heading("1",text="Item ID")
itemlist.bind("<Double-1>", select)
itemlist.grid(row=2,column=1,padx=10,pady=10)

# Nametag
Label(root,text="Name:").grid(row=3,column=0)

# 'Save' Button
saveButton=Button(text="Save")
saveButton.bind("<Button-1>",savebind)
saveButton.grid(row=1,column=0)

# 'Add New' button
newItemButton=Button(text="New Event")
newItemButton.bind("<Button-1>",newItem)
newItemButton.grid(row=0,column=1)

# Name entry text field
itemNameEntry=Entry(root,width=25)
itemNameEntry.grid(row=3,column=1)

# Submit Button
submitButton=Button(root,width=25,text="Submit")
submitButton.grid(row=4,column=1)
submitButton.bind("<Button-1>",submit)

# Begin loading
load()

# Start GUI
root.mainloop()

Upvotes: 1

Views: 2249

Answers (3)

Amanuel Ephrem
Amanuel Ephrem

Reputation: 116

If you are importing tkinter.ttk you need to import that first, then import tkinter.

from tkinter.ttk import *
from tkinter import *

Upvotes: 0

Luke.py
Luke.py

Reputation: 1005

Configure your widgets to use highlightbackground = 'white' (or whatever your background colour is) and set your highlightthickness=0

This should remove the grey outline.

EG

itemNameEntry=Entry(root,width=25, highlightbackground='white')
itemNameEntry.config(highlightthickness=0)

Upvotes: 1

gcx11
gcx11

Reputation: 128

You can use widget.config(highlightthickness=0) or pass this parameter in widget constructor.

Upvotes: 0

Related Questions