Flabada
Flabada

Reputation: 11

Python Tkinter combobox dropdown appear topleft screen corner

I face a strange issue with the Tkinter combobox. I run this simple GUI with a combobox. A month ago, on my windows 10 the tkinter combobox start to appear at topleft corner instead of below the arrow.

from tkinter.ttk import *
window = Tk()
window.title("ComboBox list down test")
window.geometry('350x200')
combo = Combobox(window)
combo['values']= (1, 2, 3, 4, 5, "Text")
combo.current(1) #set the selected item
combo.grid(column=0, row=0)
window.mainloop()

I run python 3.7.7 (I try newer version and it is not fixing the issue)

Here is a preview of what i mean: drop list on the topleft corner

When using another windows 10 with the same python 3.7.7 the combobox is ok: Combobox normal

This behavior start appening on my gui out of nowhere. It start doing this a month ago. Is there propertie on the combobox to make it display correctly.

Is someone facing the same issue?

Upvotes: 1

Views: 669

Answers (2)

Ramesh
Ramesh

Reputation: 554

use this code

change from combo = Combobox(window) to combo = ttk.Combobox(window)

from tkinter import ttk

combo = ttk.Combobox(window)

Upvotes: 0

Tingting
Tingting

Reputation: 11

I think you are using the wrong library. You should import tkinter instead of tkinter.ttk. I changed your script and it worked well.

Upvotes: 1

Related Questions