1+ from tkinter import *
2+ import tkinter as tk
3+ from PIL import ImageTk , Image
4+ import calendar
5+ root = tk .Tk ()
6+ root .geometry ('400x300' )
7+ root .title ('Calender' )
8+
9+
10+ def show ():
11+
12+ m = int (month .get ())
13+ y = int (year .get ())
14+ output = calendar .month (y ,m )
15+
16+ cal .insert ('end' ,output )
17+
18+ def clear ():
19+ cal .delete (1.0 ,'end' )
20+
21+ def exit ():
22+ root .destroy ()
23+
24+
25+
26+
27+
28+ img = ImageTk .PhotoImage (Image .open ('calendar.png' ))
29+ label = Label (image = img )
30+ label .place (x = 170 ,y = 3 )
31+
32+
33+
34+ m_label = Label (root ,text = "Month" ,font = ('verdana' ,'10' ,'bold' ))
35+ m_label .place (x = 70 ,y = 80 )
36+
37+ month = Spinbox (root , from_ = 1 , to = 12 ,width = "5" )
38+ month .place (x = 140 ,y = 80 )
39+
40+ y_label = Label (root ,text = "Year" ,font = ('verdana' ,'10' ,'bold' ))
41+ y_label .place (x = 210 ,y = 80 )
42+
43+ year = Spinbox (root , from_ = 2020 , to = 3000 ,width = "8" )
44+ year .place (x = 260 ,y = 80 )
45+
46+
47+ cal = Text (root ,width = 33 ,height = 8 ,relief = RIDGE ,borderwidth = 2 )
48+ cal .place (x = 70 ,y = 110 )
49+
50+ show = Button (root ,text = "Show" ,font = ('verdana' ,10 ,'bold' ),relief = RIDGE ,borderwidth = 2 ,command = show )
51+ show .place (x = 140 ,y = 250 )
52+
53+ clear = Button (root ,text = "Clear" ,font = ('verdana' ,10 ,'bold' ),relief = RIDGE ,borderwidth = 2 ,command = clear )
54+ clear .place (x = 200 ,y = 250 )
55+
56+ exit = Button (root ,text = "Exit" ,font = ('verdana' ,10 ,'bold' ),relief = RIDGE ,borderwidth = 2 ,command = exit )
57+ exit .place (x = 260 ,y = 250 )
58+ root .mainloop ()
0 commit comments