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!!!

Recommended Answers

All 5 Replies


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 , it was simple enough to undrestand . 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!!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.