-
Notifications
You must be signed in to change notification settings - Fork 740
/
Python GUI calendar.py
140 lines (68 loc) · 1.21 KB
/
Python GUI calendar.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
Importing tkinter module
2
from tkinter import *
3
#importing calendar module
4
import calendar
5
6
#function to show calendar of the given year
7
def showCalender():
8
gui = Tk()
9
gui.config(background='grey')
10
gui.title("Calender for the year")
11
gui.geometry("550x600")
12
year = int(year_field.get())
13
gui_content= calendar.calendar(year)
14
calYear = Label(gui, text= gui_content, font= "Consolas 10 bold")
15
calYear.grid(row=5, column=1,padx=20)
16
gui.mainloop()
1
#Driver code
2
if __name__=='__main__':
3
new = Tk()
4
new.config(background='grey')
5
new.title("Calender")
6
new.geometry("250x140")
7
cal = Label(new, text="Calender",bg='grey',font=("times", 28, "bold"))
8
year = Label(new, text="Enter year", bg='dark grey')
9
year_field=Entry(new)
10
button = Button(new, text='Show Calender',
11
fg='Black',bg='Blue',command=showCalender)
12
13
#putting widgets in position
14
cal.grid(row=1, column=1)
15
year.grid(row=2, column=1)
16
year_field.grid(row=3, column=1)
17
button.grid(row=4, column=1)
18
Exit.grid(row=6, column=1)
19
new.mainloop()
20