GUI CALENDAR USING PYTHON
Source Code:-
01 02 03 04 05 06 07 08 09 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 | # GUI CALENDAR USING PYTHON TKINTER# Required Module 1:- pip install Tk# Required Module 2:- pip install tkcalendarfrom tkinter import *from tkcalendar import Calendarroot = Tk()# Download icons in '.ico' format from https://iconarchive.com/"root.iconbitmap("D:/PYTHON MODULES/TKINTER/TKINTER PROJECTS/ICONs/Calendar.ico")root.title("GUI CALENDAR")root.geometry("600x400+300+100")root.config(bg = "olivedrab2")def valid(char): if char.isdigit(): return True else: return Falsedef btn(): root1 = Tk() root1.iconbitmap("D:/PYTHON MODULES/TKINTER/TKINTER PROJECTS/ICONs/Calendar.ico") root1.title("GUI CALENDAR") root1.geometry("980x660+200+10") root1.config(bg = "darkblue") dd = int(day.get()) mm = int(month.get()) yy = int(year.get()) Calendar(root1, font = ("None 40 bold"), year = yy, month = mm, day = dd, background = "cadetblue2", foreground = "midnightblue", headersbackground = "lightpink", normalbackground = "khaki", normalforeground = "red2").place(x = 32, y = 10) Label(root1, text = "↑\nWeeks", font = ("None 25 bold"), bg = "darkblue", fg = "cadetblue2").place(x = 15, y = 572) Button(root1, text = "Close Calendar", font = ("none 25 bold"), command = exit ,bg = "coral1", fg = "black", activebackground = "coral2", bd = 5).place(x = 330, y = 580)Label(root, text = "GUI CALENDAR", font = ("Times New Roman", 50, "bold", "underline"), bg = "olivedrab2", fg = "black").place(x = 40)Label(root, text = "Enter Date:", font = ("None 25 bold"), bg = "olivedrab2", fg = "black").place(x = 90, y = 100)Label(root, text = "Enter Month:", font = ("None 25 bold"), bg = "olivedrab2", fg = "black").place(x = 90, y = 160)Label(root, text = "Enter Year:", font = ("None 25 bold"), bg = "olivedrab2", fg = "black").place(x = 90, y = 220)reg = (root.register(valid), '%P')day = Entry(root, font = ("None 25 bold"), validate = "key", validatecommand = reg, bg = "olivedrab3", width = "10")day.place(x = 320, y = 100)month = Entry(root, font = ("None 25 bold"), validate = "key", validatecommand = reg, bg = "olivedrab3", width = "10")month.place(x = 320, y = 160)year = Entry(root, font = ("None 25 bold"), validate = "key", validatecommand = reg, bg = "olivedrab3", width = "10")year.place(x = 320, y = 220)Button(root, text = "Show Calendar", font = ("none 25 bold"), command = btn ,bg = "springgreen2", fg = "black",activebackground = "springgreen3", bd = 5).place(x = 175, y = 300)root.mainloop() |
# GUI CALENDAR USING PYTHON TKINTER
# Required Module 1:- pip install Tk
# Required Module 2:- pip install tkcalendar
from tkinter import *
from tkcalendar import Calendar
root = Tk()
# Download icons in '.ico' format from https://iconarchive.com/"
root.iconbitmap("D:/PYTHON MODULES/TKINTER/TKINTER PROJECTS/ICONs/Calendar.ico")
root.title("GUI CALENDAR")
root.geometry("600x400+300+100")
root.config(bg = "olivedrab2")
def valid(char):
if char.isdigit():
return True
else:
return False
def btn():
root1 = Tk()
root1.iconbitmap("D:/PYTHON MODULES/TKINTER/TKINTER PROJECTS/ICONs/Calendar.ico")
root1.title("GUI CALENDAR")
root1.geometry("980x660+200+10")
root1.config(bg = "darkblue")
dd = int(day.get())
mm = int(month.get())
yy = int(year.get())
Calendar(root1, font = ("None 40 bold"), year = yy, month = mm, day = dd, background = "cadetblue2", foreground = "midnightblue",
headersbackground = "lightpink", normalbackground = "khaki", normalforeground = "red2").place(x = 32, y = 10)
Label(root1, text = "↑\nWeeks", font = ("None 25 bold"), bg = "darkblue", fg = "cadetblue2").place(x = 15, y = 572)
Button(root1, text = "Close Calendar", font = ("none 25 bold"), command = exit ,bg = "coral1", fg = "black",
activebackground = "coral2", bd = 5).place(x = 330, y = 580)
Label(root, text = "GUI CALENDAR", font = ("Times New Roman", 50, "bold", "underline"), bg = "olivedrab2", fg = "black").place(x = 40)
Label(root, text = "Enter Date:", font = ("None 25 bold"), bg = "olivedrab2", fg = "black").place(x = 90, y = 100)
Label(root, text = "Enter Month:", font = ("None 25 bold"), bg = "olivedrab2", fg = "black").place(x = 90, y = 160)
Label(root, text = "Enter Year:", font = ("None 25 bold"), bg = "olivedrab2", fg = "black").place(x = 90, y = 220)
reg = (root.register(valid), '%P')
day = Entry(root, font = ("None 25 bold"), validate = "key", validatecommand = reg, bg = "olivedrab3", width = "10")
day.place(x = 320, y = 100)
month = Entry(root, font = ("None 25 bold"), validate = "key", validatecommand = reg, bg = "olivedrab3", width = "10")
month.place(x = 320, y = 160)
year = Entry(root, font = ("None 25 bold"), validate = "key", validatecommand = reg, bg = "olivedrab3", width = "10")
year.place(x = 320, y = 220)
Button(root, text = "Show Calendar", font = ("none 25 bold"), command = btn ,bg = "springgreen2",
fg = "black",activebackground = "springgreen3", bd = 5).place(x = 175, y = 300)
root.mainloop()


0 Comments