How do I create a date picker in tkinter?

前端 未结 7 1408
借酒劲吻你
借酒劲吻你 2020-11-28 09:45

Is there any standard way tkinter apps allow the user to choose a date?

7条回答
  •  温柔的废话
    2020-11-28 10:19

    Try with the following:

    from tkinter import *
    
    from tkcalendar import Calendar,DateEntry
    
    root = Tk()
    
    cal = DateEntry(root,width=30,bg="darkblue",fg="white",year=2010)
    
    cal.grid()
    
    root.mainloop()
    

    where tkcalendar library should be downloaded and installed through pip install tkcalender command.

提交回复
热议问题