Alan Gauld via Tutor wrote: > On 07/02/17 00:24, Pooja Bhalode wrote: > >> I am trying to create a calendar using tkinter GUI such that when the >> user opens the GUI, > > So far as I'm aware there is no such Calendar widget in the standard > modules, you would need to find a third party module. > >> Can some one please help me with this? I looked up on the website, I came >> across this one, >> http://stackoverflow.com/questions/27774089/ >> python-calendar-widget-return-the-user-selected-date >> But when I try to run it, it gives me an error saying that it is not able >> to recognize Calendar. > > I'm really puzzled by that post because there is non Calendar widget > in ttk (or Tix) as of Python 3.4. They are discussing code that > should not work but they seem to have it working. I assume there > is a non standard ttk module out there somewhere?
The question on stackoverflow points to http://svn.python.org/projects/sandbox/trunk/ttk-gsoc/samples/ttkcalendar.py A few imports are sufficient to turn test2() from the answer into a working script (python 2): $ cat demo.py #!/usr/bin/env python import calendar import ttk import Tkinter from ttkcalendar import Calendar def test2(): import sys root = Tkinter.Tk() root.title('Ttk Calendar') ttkcal = Calendar(firstweekday=calendar.SUNDAY) ttkcal.pack(expand=1, fill='both') if 'win' not in sys.platform: style = ttk.Style() style.theme_use('clam') root.mainloop() x = ttkcal.selection print 'x is: ', x test2() $ ./demo.py x is: 2017-05-11 00:00:00 _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor