Home > database >  How to change the layout of a Tkinter Combobox?
How to change the layout of a Tkinter Combobox?

Time:08-26

To make the border disapear or simply change it's color. I tried with highlighttickness or borderwidth but it doesn't work. So I was told to try with the layouts, the thing is I don't know how to change the border with the layouts

On this pic the border is still visible on the combobox I want to delete it or just change it's color

PS : That's not a duplicate previous questions were deleted

test

CodePudding user response:

You can change the layout with the layout method of a style object. It can take as an argument a new layout to replace the current layout.

The following example illustrates how to remove the padding element around the checkbox, which I think might be the source of your light gray border:

style = ttk.Style()
layout = [
    ('Combobox.button', {
        'sticky': 'nswe',
        'children': [
                    ('Combobox.textarea', {
                        'sticky': 'nswe'
                    })
                ]
            })
]
style.layout("TCombobox", layout)

Changing styles and style layouts is unfortunately an under-documented feature of tkinter. However, there are several resources on the internet you might find useful:

  • Related