unresponsive clicking on ttk combobox [closed]

I can open the combo box and select the highlighted option by pressing the Enter key, but using the mouse requires multiple clicks. A second or third attempt to change the selection may need a lot of repeated clicks.

import tkinter as tk
from tkinter import ttk

root = tk.Tk()
root.title("combo box test")
main_frame = ttk.Frame(root, padding="5 5 5 5")
main_frame.grid(column=0, row=0, sticky=(tk.N, tk.W, tk.E, tk.S))

range_value = tk.StringVar()
range_combo = ttk.Combobox(main_frame, state="readonly", textvariable=range_value)

range_combo["values"] = (
    "1day",
    "last7days",
    "last14days",
    "last30days",
    "last365days",
)
range_combo.set("last30days")
range_combo.grid(row=0, column=1)

root.mainloop()

Other GUI components are working as expected, but even in this minimal example the combo box is acting up. I checked a few tutorials and other SO questions but I’m not seeing where I’ve gone wrong.

  • I could not reproduce the issue, running windows 11, python 3.11.5. The widget respopnds to mouse clicks on the first try for me.

    – 

  • Couldn’t reproduce this under Windows 10, Python 3.11.3 either, FWIW

    – 

  • Thank you both for checking. Sounds like it may be an environment issue. tk 8.6.12, python 3.11.5, conda 23.7.4, macOS 14.1.1 (M1)

    – 

  • code works correctly on Linux Mint 21, Python 3.10

    – 




  • Also, it works on Window 10, Python 3.12.0rc3

    – 

Leave a Comment