Is it possible to get a dropdown list of date just by a single click in tkcalendar of tkinter python?

56 Views Asked by At

I'm working on a date entry using DateEntry in tkcalendar of tkinter python with the code below. While running I have to double-click the down arrow button beside the DateEntry space to get a drop-down date list, is it possible to get the list just by a single click on the arrow button? I've searched a lot across the web and got no results so far. Any suggestion is welcome, thanks in advance!

import tkinter as tk
from tkinter import ttk
from tkcalendar import DateEntry

window = tk.Tk()
window.geometry("514x384+0+0")

def show_date():
    data = aDate.get()
    var.set(str(data))

var = tk.StringVar()
label1 = ttk.Label(window, text="Please pick a Date:")
label2 = ttk.Label(window,textvariable=var)
aButton = ttk.Button(window,text = 'submit',command=show_date)
aDate = DateEntry(window,selectmode='day')
label1.grid(row=0,column=0)
label2.grid(row=1,column=0)
aDate.grid(row=2,column=0)
aButton.grid(row=2,column=1)

window.mainloop()

After reading the other question DateEntry class in tkcalendar bug in runtime, I think my question is probably related with my macOS version which is Monterey version 12.6.8, any comments or suggestions are welcome, thanks!

0

There are 0 best solutions below