Question: generate the python tkinter code for the following functions: CHECK _ FOR _ EXISTING _ EVENT, ADD _ EVENT, SAVE _ EVENT, VIEW _ EVENT,
generate the python tkinter code for the following functions: CHECKFOREXISTINGEVENT, ADDEVENT, SAVEEVENT, VIEWEVENT, EDITEVENT, and DELETEEVENT, and ensure to incorporate DATA VALIDATION on the functions that need it ADDEVENT & EDITEVENt A listbox is used to contain and highlight the events, entry boxes are used to gather the TITLE, TIME, and DESCRIPTION of the events and they are contained on the second window: the EVENT MANAGEMT WINDOW, and a calendar widget is used to gather the DATE. The following code is what I have generated so far, Please USE IT to develop the functions and other details mentioned. Thank you.
import tkinter as tk
from tkinter import ttk
from tkcalendar import Calendar
from PIL import ImageTk,Image
import datetime
from tkinter import simpledialog
class EventManagementWindowtkToplevel:
def initself parent:
superinitparent
self.configbackground"dodgerblue
self.titleEvent Management'
self.geometryx
self.parent parent
self.createwidgets
def addeventself:
if eventname and eventdate:
# Check if the event already exists
if feventdate: eventname in self.eventlistbox.get tkEND:
tkmessagebox.showerrorError "This event already exists."
else:
self.eventlistbox.inserttkEND, feventdate: eventname
self.parent.highlighteventeventdate
def editeventself:
selectedindex self.eventlistbox.curselection
if selectedindex:
currenttext self.eventlistbox.getselectedindex
neweventname tksimpledialog.askstringEdit Event", "Enter new event name:", initialvaluecurrenttext.split:
if neweventname:
# Check if the new event already exists
if fcurrenttext.split: : neweventname in self.eventlistbox.get tkEND:
tkmessagebox.showerrorError "This event already exists."
else:
self.eventlistbox.deleteselectedindex
self.eventlistbox.insertselectedindex, fcurrentt
class MainWindowtkTk:
def initself:
superinit
self.configbackground"azure
self.titleCalendar
self.geometryx
self.createwidgets
self.events
def createwidgetsself:
self.calendar Calendarself selectmode"day",
yeardatetime.datetime.nowyear,
monthdatetime.datetime.nowmonth,
daydatetime.datetime.nowday,
fontArial Black", "bold"
background"dodgerblue
foreground"Black",
headersbackground"firebrick",
headersforeground"Black",
selectforeground"darkslategray
selectbackground"yellow",
weekendforeground"Black",
weekendbackground"dodgerblue
othermonthforeground"darkslategray
othermonthbackground"gainsboro",
disabledforeground"Black",
disabledbackground"dimgray"
self.calendar.packpady
self.manageeventsbutton tkButtonself text'Manage Events', activebackground"yellow", background"dodgerblue fontArial Black", "bold" width height commandself.openeventmanagement
self.manageeventsbutton.pack
# Create the exit program button
self.quitbutton tkButtonself text"Exit Program", activebackground"yellow", background"firebrick", fontArial Black", "bold" width height commandself.quit
self.quitbutton.packside"bottom", anchore padx pady
def openeventmanagementself:
self.eventmanagementwindow EventManagementWindowself
def highlighteventself eventdate:
if eventdate not in self.events:
self.eventseventdate self.calendar.caleventcreatedateeventdate, text'Event', tags'highlight'
self.calendar.tagconfighighlight background'orange', foreground'black'
def unhighlighteventself eventdate:
if eventdate in self.events:
self.calendar.caleventremoveselfeventseventdate
del self.eventseventdate
if namemain:
app MainWindow
app.mainloop
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
