Tkinter calendar widget - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: GUI (https://python-forum.io/forum-10.html) +--- Thread: Tkinter calendar widget (/thread-26475.html) |
Tkinter calendar widget - scratchmyhead - May-03-2020 Hello. I'm new to Python and just started using Tkinter. I'm trying to use a calendar widget and I found this code from google search. The code works fine on my work computer but for some reason, it doesn't work on my home computer. Below is the code and I have attached a pic of the output screen. Any help would be appreciated. try: import tkinter as tk from tkinter import ttk except ImportError: import Tkinter as tk import ttk from tkcalendar import Calendar, DateEntry def example1(): def print_sel(): print(cal.selection_get()) top = tk.Toplevel(root) cal = Calendar(top, font="Arial 14", selectmode='day', cursor="hand1", year=2018, month=2, day=5) cal.pack(fill="both", expand=True) ttk.Button(top, text="ok", command=print_sel).pack() def example2(): top = tk.Toplevel(root) ttk.Label(top, text='Choose date').pack(padx=10, pady=10) cal = DateEntry(top, width=12, background='darkblue', foreground='white', borderwidth=2) cal.pack(padx=10, pady=10) root = tk.Tk() s = ttk.Style(root) s.theme_use('clam') ttk.Button(root, text='Calendar', command=example1).pack(padx=10, pady=10) ttk.Button(root, text='DateEntry', command=example2).pack(padx=10, pady=10) root.mainloop() RE: Tkinter calendar widget - menator01 - May-03-2020 Did you do python3.8 -m pip install tkcalendar or which ever python version you're using? RE: Tkinter calendar widget - scratchmyhead - May-03-2020 I'm using Python 3.8 but I think that my work computer is Python 3.7 RE: Tkinter calendar widget - menator01 - May-03-2020 python3.8 is what I use RE: Tkinter calendar widget - scratchmyhead - May-03-2020 Could someone help me out with this problem? Thanks. |