hi everybody , I am new to python and interested in graphics . I like somebody to walk me thru monthly calendar using tkinter . I have already printed 07 calendar using python but I am stuck when it comes to use it with tkinter . it is no homework , I am 50 years old and have passed all my exams!!!

10 Years
Discussion Span
Last Post by vegaseat


I once wrote a Calendar widget for Tkinter. You can find it here (it's a german forum, but the code is in english :)):

You can also find two improvements posted by some others in this thread.
If you have any questions, feel free to ask ;)

Regards, mawe


Here is something very simple that you can fancy up with a +/- year and a +/- month button:

# as simple monthly calendar with Tkinter

# give calendar and Tkinter abbreviated namespaces
import calendar as cd
import Tkinter as tk

# supply year and month
year = 2007
month = 2    # jan=1

# assign the month's calendar to a multiline string
str1 = cd.month(year, month)

# create the window form and call it root (typical)
root = tk.Tk()
root.title("Monthly Calendar")

# pick a fixed font like courier so spaces behave right 
label1 = tk.Label(root, text=str1, font=('courier', 14, 'bold'), bg='yellow')
label1.pack(padx=3, pady=5)

# run the event loop (needed)

thanks , Ilooked at the code and it seems not so easy for me to digest but I will do my best , thanks again


thanks , Ilooked at the code and it seems not so easy for me to digest but I will do my best , thanks again

If this is your first experience with GUI programming, it will take some time to digest. However, playing with labels, buttons, windows and mouse clicks is fun, once you get the hang of it. Keep experimenting with the code! There are quite a number of good Tkinter GUI examples on this forum.

Also, welcome to the Python forum!!!!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.