How to remove black border when GUI is selected?

前端 未结 1 1065
眼角桃花
眼角桃花 2021-01-21 03:54

I am trying to add an Entry widget to a Frame with a Scrollbar. When I click on the GUI, a black border appears:

impor         


        
相关标签:
1条回答
  • 2021-01-21 04:08

    To remove the border of your widgets (for example of a Text widget) set the highlightthickness attribute to 0.

    Here, you have a working example:

    import tkinter as tk
    
    class Example(tk.Frame):
        def __init__(self, master):
            tk.Frame.__init__(self, master)
            self.text = tk.Text(self, highlightthickness=0)
            self.text.pack(expand=1, fill='both')
    
    root = tk.Tk()
    Example(root).pack(expand=1, fill='both')
    root.mainloop()
    
    0 讨论(0)
提交回复
热议问题