[Tutor] Tkinter Calendar to receive user entry.

Pooja Bhalode poojabhalode11 at gmail.com
Tue Feb 7 09:39:03 EST 2017


Hi Alan,

Thank you so much for your advice, I would start looking into learning some
object oriented programming to make myself familiar with it. That would
help me move ahead as well.

Hi Peter,

Thank you so much for your reply. Yes, that was the example that I was
looking at on stackoverflow. Yes, it works for me as well now. Thanks a lot
for your help there.

Yours truly,
Pooja

On Tue, Feb 7, 2017 at 5:18 AM, Peter Otten <__peter__ at web.de> wrote:

> 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 at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>


More information about the Tutor mailing list