def drawAditionalDataWindow(jobA, jobB, jobC, queueQuantity, quantum, period, arrivalJobA, arrivalJobB, arrivalJobC, runTimeJobA, runTimeJobB, runTimeJobC, ioJobC, ioJobB, ioJobA, startIoJobC, startIoJobB, startIoJobA, basicDataWindow, mainWindow): basicDataWindow.withdraw() #Window or root: First we should create the root or window aditionalDataWindow = tk.Toplevel() aditionalDataWindow.title("MLFQ Simulation - Aditional Data Window") aditionalDataWindow.resizable(False, False) aditionalDataWindow.config(bg='#EAF6F5') aditionalDataWindow.geometry('850x400+500+150') #Create the widgets and add them in a grid to add all the widgets needed in the right places #Labels tk.Label(aditionalDataWindow, text="Additional Data", font=("Arial", 18), bg='#EAF6F5').grid(row=0, column=0, sticky="W", columnspan=5, padx=10, pady=20) tk.Label(aditionalDataWindow, text="Start Time", font=("Arial", 14), bg='#EAF6F5').grid(row=1, column=1, sticky="W", padx=10, pady=10) tk.Label(aditionalDataWindow, text="Run Time", font=("Arial", 14), bg='#EAF6F5').grid(row=1, column=2, sticky="W", padx=10, pady=10) tk.Label(aditionalDataWindow, text="I/O Time", font=("Arial", 14), bg='#EAF6F5').grid(row=1, column=3, sticky="W", padx=10, pady=10) tk.Label(aditionalDataWindow, text="I/O process frequency*", font=("Arial", 10), bg='#EAF6F5').grid(row=1, column=4, sticky="W", padx=10, pady=10) tk.Label(aditionalDataWindow, text="Job A:", font=("Arial", 14), bg='#EAF6F5').grid(row=2, column=0, sticky="E", padx=10, pady=10) tk.Label(aditionalDataWindow, text="Job B:", font=("Arial", 14), bg='#EAF6F5').grid(row=3, column=0, sticky="E", padx=10, pady=10) tk.Label(aditionalDataWindow, text="Job C:", font=("Arial", 14), bg='#EAF6F5').grid(row=4, column=0, sticky="E", padx=10, pady=10) tk.Label( aditionalDataWindow, text= "*In this field, this value is taking into account if I/O time field has a value", font=("Arial", 12), bg='#EAF6F5', fg="gray").grid(row=6, column=0, sticky="W", padx=200, columnspan=5) #Inputs or fields validation = basicDataWindow.register(sgf.onlyNumbers) #JOB A arrivalJobAField = tk.Entry(aditionalDataWindow, font=("Arial"), fg="gray", width=12, textvariable=arrivalJobA, validate="key", validatecommand=(validation, '%S')) arrivalJobAField.grid(row=2, column=1, sticky="W", padx=10, pady=10) runTimeJobAField = tk.Entry(aditionalDataWindow, font=("Arial"), fg="gray", width=12, textvariable=runTimeJobA, validatecommand=(validation, '%S')) runTimeJobAField.grid(row=2, column=2, sticky="W", padx=10, pady=10) ioJobAField = tk.Entry(aditionalDataWindow, font=("Arial"), fg="gray", width=12, textvariable=ioJobA, validate="key", validatecommand=(validation, '%S')) ioJobAField.grid(row=2, column=3, sticky="W", padx=10, pady=10) startIoJobAField = tk.Entry(aditionalDataWindow, font=("Arial"), fg="gray", width=12, textvariable=startIoJobA, validate="key", validatecommand=(validation, '%S')) startIoJobAField.grid(row=2, column=4, sticky="W", padx=10, pady=10) #JOB B arrivalJobBField = tk.Entry(aditionalDataWindow, font=("Arial"), fg="gray", width=12, validate="key", textvariable=arrivalJobB, validatecommand=(validation, '%S'), state=disbledEnabledFieldsB( jobA.getQuantity())) arrivalJobBField.grid(row=3, column=1, sticky="W", padx=10, pady=10) runTimeJobBField = tk.Entry(aditionalDataWindow, font=("Arial"), fg="gray", width=12, validate="key", textvariable=runTimeJobB, validatecommand=(validation, '%S'), state=disbledEnabledFieldsB( jobA.getQuantity())) runTimeJobBField.grid(row=3, column=2, sticky="W", padx=10, pady=10) ioJobBField = tk.Entry(aditionalDataWindow, font=("Arial"), fg="gray", width=12, validate="key", textvariable=ioJobB, validatecommand=(validation, '%S'), state=disbledEnabledFieldsB(jobA.getQuantity())) ioJobBField.grid(row=3, column=3, sticky="W", padx=10, pady=10) startIoJobBField = tk.Entry(aditionalDataWindow, font=("Arial"), fg="gray", width=12, validate="key", textvariable=startIoJobB, validatecommand=(validation, '%S'), state=disbledEnabledFieldsB( jobA.getQuantity())) startIoJobBField.grid(row=3, column=4, sticky="W", padx=10, pady=10) #JOB C arrivalJobCField = tk.Entry(aditionalDataWindow, font=("Arial"), fg="gray", width=12, validate="key", textvariable=arrivalJobC, validatecommand=(validation, '%S'), state=disbledEnabledFieldsB( jobA.getQuantity())) arrivalJobCField.grid(row=4, column=1, sticky="W", padx=10, pady=10) runTimeJobCField = tk.Entry(aditionalDataWindow, font=("Arial"), fg="gray", width=12, validate="key", textvariable=runTimeJobC, validatecommand=(validation, '%S'), state=disbledEnabledFieldsC( jobA.getQuantity())) runTimeJobCField.grid(row=4, column=2, sticky="W", padx=10, pady=10) ioJobCField = tk.Entry(aditionalDataWindow, font=("Arial"), fg="gray", width=12, validate="key", textvariable=ioJobC, validatecommand=(validation, '%S'), state=disbledEnabledFieldsC(jobA.getQuantity())) ioJobCField.grid(row=4, column=3, sticky="W", padx=10, pady=10) startIoJobCField = tk.Entry(aditionalDataWindow, font=("Arial"), fg="gray", width=12, validate="key", textvariable=startIoJobC, validatecommand=(validation, '%S'), state=disbledEnabledFieldsC( jobA.getQuantity())) startIoJobCField.grid(row=4, column=4, sticky="W", padx=10, pady=10) #Buttons startButton = tk.Button( aditionalDataWindow, text="OK", width=10, height=2, font=("Arial"), command=lambda: eventstartButton( jobA, jobB, jobC, queueQuantity, quantum, period, arrivalJobA, arrivalJobB, arrivalJobC, runTimeJobA, runTimeJobB, runTimeJobC, ioJobC, ioJobB, ioJobA, startIoJobC, startIoJobB, startIoJobA, aditionalDataWindow, mainWindow)) startButton.grid(row=5, column=0, sticky="E", padx=30, pady=20, columnspan=3) closeButtonAW = tk.Button(aditionalDataWindow, text="CLOSE", width=10, height=2, font=("Arial"), command=lambda: sgf.eventCloseButton(mainWindow)) closeButtonAW.grid(row=5, column=3, sticky="W", padx=10, pady=20, columnspan=2)
def drawSimulationWindow(jobA, jobB, jobC, queueQuantity, quantum, period, aditionalDataWindow, mainWindow): aditionalDataWindow.withdraw() simulationWindow = tk.Toplevel() simulationWindow.title("MLFQ Simulation - Simulation Window") simulationWindow.resizable(False, False) simulationWindow.config(bg='#EAF6F5') simulationWindow.geometry('1550x650+30+150') entrytime = tk.StringVar() #Create the widgets and add them in a grid to add all the widgets needed in the right places #Labels tk.Label(simulationWindow, text="Simulation MLFQ", font=("Arial", 18), bg='#EAF6F5').grid(row=0, column=0, sticky="W", columnspan=100, pady=10) tk.Label(simulationWindow, text="Counter(ms):", font=("Arial", 14), bg='#EAF6F5').grid(row=1, column=0, sticky="E", pady=10, columnspan=96) tk.Label(simulationWindow, text="Process Graph.", font=("Arial", 14), bg='#EAF6F5').grid(row=2, column=0, columnspan=100, pady=3) #Label q2, q1, q0 tk.Label(simulationWindow, text="Q2", font=("Arial", 12), bg='#EAF6F5', width=0, height=2).grid(row=3, column=0, padx=2, sticky="S") tk.Label(simulationWindow, text="Q1", font=("Arial", 12), bg='#EAF6F5', width=0, height=2).grid(row=4, column=0, padx=2, sticky="S") tk.Label(simulationWindow, text="Q0", font=("Arial", 12), bg='#EAF6F5', width=0, height=2).grid(row=5, column=0, padx=2, sticky="S") tk.Label(simulationWindow, text="ms", font=("Arial", 12), bg='#EAF6F5', width=0, height=2).grid(row=6, column=0, padx=2, sticky="N") tk.Label(simulationWindow, text="0", font=("Arial", 8), bg='#EAF6F5', width=0, height=2).grid(row=6, column=1, pady=2, sticky="N") tk.Label(simulationWindow, text="25", font=("Arial", 5), bg='#EAF6F5', width=0, height=2).grid(row=6, column=26, pady=2, sticky="N") tk.Label(simulationWindow, text="50", font=("Arial", 5), bg='#EAF6F5', width=0, height=2).grid(row=6, column=51, pady=2, sticky="N") tk.Label(simulationWindow, text="75", font=("Arial", 5), bg='#EAF6F5', width=0, height=2).grid(row=6, column=76, pady=2, sticky="N") tk.Label(simulationWindow, text="100", font=("Arial", 3), bg='#EAF6F5', width=0, height=2).grid(row=6, column=100, pady=2, sticky="N") tk.Label(simulationWindow, text="Color for corresponding processes*", font=("Arial", 14), bg='#EAF6F5', fg="gray").grid(row=8, column=0, columnspan=100, pady=10) tk.Label(simulationWindow, text="Simulator management*", font=("Arial", 14), bg='#EAF6F5', fg="gray").grid(row=10, column=0, columnspan=100, pady=20) #Labels to pain the jobs execution #Draw JobA jobALabelDraw = tk.Label(simulationWindow, bg='#CB8665', width=0, height=2) jobALabelDraw.grid(row=9, column=30, pady=2) tk.Label(simulationWindow, text="JobA", font=("Arial", 12), bg='#EAF6F5', fg="gray").grid(row=9, column=31, pady=2, columnspan=9, sticky="W") #Draw JobB jobBLabelDraw = tk.Label(simulationWindow, bg='#FDBCB4', width=0, height=2) jobBLabelDraw.grid(row=9, column=41, pady=2) tk.Label(simulationWindow, text="JobB", font=("Arial", 12), bg='#EAF6F5', fg="gray").grid(row=9, column=42, pady=2, columnspan=9, sticky="W") #Draw JobC jobCLabelDraw = tk.Label(simulationWindow, bg='#E6D690', width=0, height=2) jobCLabelDraw.grid(row=9, column=52, pady=2) tk.Label(simulationWindow, text="JobC", font=("Arial", 12), bg='#EAF6F5', fg="gray").grid(row=9, column=53, pady=2, columnspan=9, sticky="W") #Draw I/O ioLabelDraw = tk.Label(simulationWindow, bg="gray", width=0, height=2) ioLabelDraw.grid(row=9, column=63, pady=2) tk.Label(simulationWindow, text="I/O", font=("Arial", 12), bg='#EAF6F5', fg="gray").grid(row=9, column=64, pady=2, columnspan=9, sticky="W") #Field - Entry resultCounter = tk.Entry(simulationWindow, text="Results", textvariable=entrytime, font=("Arial", 12), bg='#EAF6F5', fg="gray", justify="right", width=6) resultCounter.grid(row=1, column=96, pady=10, sticky="E", columnspan=5) #Buttons pauseButton = tk.Button(simulationWindow, text="PAUSE", width=10, height=2, font=("Arial"), state="disable", command=lambda: eventPauseButton()) pauseButton.grid(row=11, column=35, pady=20, columnspan=10) startButtonSW = tk.Button(simulationWindow, text="START", width=10, height=2, font=("Arial"), command=lambda: eventStartButtonSW( jobA, jobB, jobC, queueQuantity, quantum, period, simulationWindow, entrytime)) startButtonSW.grid(row=11, column=46, pady=20, columnspan=10) resultButton = tk.Button( simulationWindow, text="RESULT", width=10, height=2, font=("Arial"), command=lambda: eventResultButton(jobA, jobB, jobC, simulationWindow, mainWindow)) resultButton.grid(row=12, column=40, pady=20, columnspan=10) finishButton = tk.Button(simulationWindow, text="FINISH", width=10, height=2, font=("Arial"), state="disable", command=lambda: eventFinishButton()) finishButton.grid(row=11, column=56, pady=20, columnspan=10) closeButtonSW = tk.Button(simulationWindow, text="CLOSE", width=10, height=2, font=("Arial"), command=lambda: sgf.eventCloseButton(mainWindow)) closeButtonSW.grid(row=12, column=51, pady=20, columnspan=10) drawEmpty(simulationWindow)
def drawBasicDataWindow(jobA, jobB, jobC, queueQuantity, quantumTime, periodTime, mainWindow): mainWindow.withdraw() #Function basicWindowWithdraw basicDataWindow=tk.Toplevel() basicDataWindow.title("MLFQ Simulation - Basic Data Window") basicDataWindow.resizable(False,False) basicDataWindow.config(bg='#EAF6F5') basicDataWindow.geometry('500x500+500+150') #variables from fields I need to recover from Aditional Data window arrivalJobA=tk.StringVar() runTimeJobA=tk.StringVar() ioJobA=tk.StringVar() startIoJobA=tk.StringVar() arrivalJobB=tk.StringVar() runTimeJobB=tk.StringVar() ioJobB=tk.StringVar() startIoJobB=tk.StringVar() arrivalJobC=tk.StringVar() runTimeJobC=tk.StringVar() ioJobC=tk.StringVar() startIoJobC=tk.StringVar() #Create the widgets and add them in a grid to add all the widgets needed in the right places #Labels tk.Label(basicDataWindow,text="Jobs, period & Basic data", font=("Arial", 18), bg='#EAF6F5').grid(row=0, column=0, sticky="W", columnspan=2, padx=10, pady=20) tk.Label(basicDataWindow,text="Priority", font=("Arial", 10), bg='#EAF6F5').grid(row=1, column=1, sticky="W", padx=20, pady=1) tk.Label(basicDataWindow,text="Job A:*", font=("Arial", 14), bg='#EAF6F5').grid(row=2, column=0, sticky="E", padx=10, pady=10) jobBLabel=tk.Label(basicDataWindow,text="Job B:*", font=("Arial", 14), bg='#EAF6F5') jobBLabel.grid(row=3, column=0, sticky="E", padx=10, pady=10) jobCLabel=tk.Label(basicDataWindow,text="Job C:*", font=("Arial", 14), bg='#EAF6F5') jobCLabel.grid(row=4, column=0, sticky="E", padx=10, pady=10) tk.Label(basicDataWindow,text="----------------------------------------------------------------------------------------", font=("Arial", 12), bg='#EAF6F5', fg="gray").grid(row=5, column=0, sticky="W",columnspan=2, padx=40) tk.Label(basicDataWindow,text="Quantum time:*", font=("Arial", 14), bg='#EAF6F5').grid(row=6, column=0, sticky="E", padx=10, pady=10) tk.Label(basicDataWindow,text="Period time 'S':*", font=("Arial", 14), bg='#EAF6F5').grid(row=7, column=0, sticky="E", padx=10, pady=10) tk.Label(basicDataWindow,text="Do you want to add more", font=("Arial", 12), bg='#EAF6F5').grid(row=8, column=0, sticky="E", padx=10) tk.Label(basicDataWindow,text="information for the simulation?", font=("Arial", 12), bg='#EAF6F5').grid(row=9, column=0, sticky="E", padx=10) #Inputs or fields validation = basicDataWindow.register(sgf.onlyNumbers) quantumField=tk.Entry(basicDataWindow, font=("Arial"), fg="gray", width=17, textvariable=quantumTime, validate="key", validatecommand=(validation, '%S')) quantumField.grid(row=6, column=1, sticky="W", padx=20, pady=10) periodField=tk.Entry(basicDataWindow, font=("Arial"), fg="gray", width=17, textvariable=periodTime, validate="key", validatecommand=(validation, '%S')) periodField.grid(row=7, column=1, sticky="W", padx=20, pady=10) #ComboBox options=["Low", "Medium", "High"] twoOptions=["Yes", "No"] jobAComboBox=cb.Combobox(basicDataWindow, width=14, state="readonly") jobAComboBox.grid(row=2, column=1, sticky="W", padx=20, pady=10) jobAComboBox['values']=options jobAComboBox.current(newindex=2) jobBComboBox=cb.Combobox(basicDataWindow, width=14, state=disbledEnabledComboBoxB(jobA.getQuantity())) jobBComboBox.grid(row=3, column=1, sticky="W", padx=20, pady=10) jobBComboBox['values']=options jobBComboBox.current(newindex=2) jobCComboBox=cb.Combobox(basicDataWindow, width=14, state=disbledEnabledComboBoxC(jobA.getQuantity())) jobCComboBox.grid(row=4, column=1, sticky="W", padx=20, pady=10) jobCComboBox['values']=options jobCComboBox.current(newindex=2) jobTwoOptionsComboBox=cb.Combobox(basicDataWindow, width=14, state="readonly") jobTwoOptionsComboBox.grid(row=8, column=1, sticky="W", padx=20, pady=10, rowspan=2) jobTwoOptionsComboBox['values']=twoOptions jobTwoOptionsComboBox.current(newindex=0) #Buttons okButtonBW=tk.Button(basicDataWindow, text="OK", width=10, height=2, font=("Arial"), command=lambda:eventOkBWButton(jobA, jobB, jobC, queueQuantity, quantumTime, periodTime, jobAComboBox, jobBComboBox, jobCComboBox, jobTwoOptionsComboBox, arrivalJobA, arrivalJobB, arrivalJobC, runTimeJobA, runTimeJobB, runTimeJobC, ioJobC, ioJobB, ioJobA, startIoJobC, startIoJobB, startIoJobA, basicDataWindow, mainWindow)) okButtonBW.grid(row=10, column=0, sticky="E", padx=10, pady=20) cancelButtonBW=tk.Button(basicDataWindow, text="CLOSE", width=10, height=2, font=("Arial"), command=lambda:sgf.eventCloseButton(mainWindow)) cancelButtonBW.grid(row=10, column=1, sticky="W", padx=10, pady=20)
def drawResultWindow(jobA, jobB, jobC, simulationWindow, mainWindow, timeList, jobList, queueList, avgResponse, avgTurnAround,resultados): simulationWindow.withdraw() resultWindow=tk.Toplevel() resultWindow.title("MLFQ Simulation - Result Window") resultWindow.resizable(False,False) resultWindow.config(bg='#EAF6F5') resultWindow.geometry('740x660+500+100') #Create the widgets and add them in a grid to add all the widgets needed in the right places #Labels tk.Label(resultWindow,text="Simulation Results ", font=("Arial", 18), bg='#EAF6F5').grid(row=0, column=0, sticky="W", columnspan=4, padx=10, pady=10) tk.Label(resultWindow,text="Scheduler Results each milisecond.* ", font=("Arial", 10), bg='#EAF6F5', fg="gray").grid(row=1, column=0, padx=10, columnspan=4) tk.Label(resultWindow,text="Final Data results* ", font=("Arial", 10), bg='#EAF6F5', fg="gray").grid(row=3, column=0, padx=10, pady=10, columnspan=4) tk.Label(resultWindow,text="Job Status", font=("Arial", 14), bg='#EAF6F5').grid(row=4, column=1, sticky="W", padx=10, pady=10) tk.Label(resultWindow,text="Turn Around", font=("Arial", 14), bg='#EAF6F5').grid(row=4, column=2, sticky="W", padx=10, pady=10) tk.Label(resultWindow,text="Responsive Time", font=("Arial", 14), bg='#EAF6F5').grid(row=4, column=3, sticky="W", padx=10, pady=10) tk.Label(resultWindow,text="Job A:", font=("Arial", 14), bg='#EAF6F5').grid(row=5, column=0, sticky="E", padx=10, pady=10) tk.Label(resultWindow,text="Job B:", font=("Arial", 14), bg='#EAF6F5').grid(row=6, column=0, sticky="E", padx=10, pady=10) tk.Label(resultWindow,text="Job C:", font=("Arial", 14), bg='#EAF6F5').grid(row=7, column=0, sticky="E", padx=10, pady=10) tk.Label(resultWindow,text="Average:", font=("Arial", 14), bg='#EAF6F5').grid(row=8, column=0, sticky="E", padx=10, pady=10) #------IM HERE Text widget to add results textResults=tk.Text(resultWindow, font=("Arial", 14), fg="gray", width=75, height=7, bg='#EAF6F5', cursor="arrow", highlightcolor='#EAF6F5') textResults.grid(row=2, column=0, pady=10, padx=10, columnspan=4) textResults.insert("insert", resultados) #Scroll bar scrollYTextResults=tk.Scrollbar(resultWindow, command=textResults.yview) scrollYTextResults.grid(row=2, column=0, pady=10, sticky="NSE", columnspan=4) textResults.config(yscrollcommand=scrollYTextResults.set) #Fields or Entries #JOB A #---We need to add the job status statusJobAField=tk.Entry(resultWindow, font=("Arial"), fg="gray", width=10, justify="center", cursor="arrow") statusJobAField.grid(row=5, column=1, padx=10, pady=10) statusJobAField.insert(0, setStatus(jobA)) aroundJobAField=tk.Entry(resultWindow, font=("Arial"), fg="gray", width=10, justify="center", cursor="arrow") aroundJobAField.grid(row=5, column=2, padx=10, pady=10) aroundJobAField.insert(0, jobA.getTurnAround()) responsiveJobAField=tk.Entry(resultWindow, font=("Arial"), fg="gray", width=10, justify="center", cursor="arrow") responsiveJobAField.grid(row=5, column=3, padx=10, pady=10) responsiveJobAField.insert(0, jobA.getResponsiveTime()) #JOB B statusJobBField=tk.Entry(resultWindow, font=("Arial"), fg="gray", width=10, justify="center", cursor="arrow") statusJobBField.grid(row=6, column=1, padx=10, pady=10) statusJobBField.insert(0, setStatus(jobB)) aroundJobBField=tk.Entry(resultWindow, font=("Arial"), fg="gray", width=10, justify="center", cursor="arrow") aroundJobBField.grid(row=6, column=2, padx=10, pady=10) aroundJobBField.insert(0, jobB.getTurnAround()) responsiveJobBField=tk.Entry(resultWindow, font=("Arial"), fg="gray", width=10, justify="center", cursor="arrow") responsiveJobBField.grid(row=6, column=3, padx=10, pady=10) responsiveJobBField.insert(0, jobB.getResponsiveTime()) #JOB C statusJobCField=tk.Entry(resultWindow, font=("Arial"), fg="gray", width=10, justify="center", cursor="arrow") statusJobCField.grid(row=7, column=1, padx=10, pady=10) statusJobCField.insert(0, setStatus(jobC)) aroundJobCField=tk.Entry(resultWindow, font=("Arial"), fg="gray", width=10, justify="center", cursor="arrow") aroundJobCField.grid(row=7, column=2, padx=10, pady=10) aroundJobCField.insert(0, jobC.getTurnAround()) responsiveJobCField=tk.Entry(resultWindow, font=("Arial"), fg="gray", width=10, justify="center", cursor="arrow") responsiveJobCField.grid(row=7, column=3, padx=10, pady=10) responsiveJobCField.insert(0, jobC.getResponsiveTime()) #Average aroundAverage=tk.Entry(resultWindow, font=("Arial"), fg="gray", width=10, justify="center", cursor="arrow") aroundAverage.grid(row=8, column=2, padx=10, pady=10) aroundAverage.insert(0, round(avgTurnAround,2)) responsiveAverage=tk.Entry(resultWindow, font=("Arial"), fg="gray", width=10, justify="center", cursor="arrow") responsiveAverage.grid(row=8, column=3, padx=10, pady=10) responsiveAverage.insert(0, round(avgResponse, 2)) #Buttons closeButton=tk.Button(resultWindow, text="CLOSE", width=12, height=2, font=("Arial"), command=lambda:sgf.eventCloseButton(mainWindow)) closeButton.grid(row=9, column=0, padx=40, pady=20, columnspan=4)
validate="key", validatecommand=(validation, '%S')) queueField.grid(row=1, column=1, sticky="W", padx=5, pady=5) jobField = tk.Entry(mainWindow, font=("Arial"), fg="gray", textvariable=quantityJob, validate="key", validatecommand=(validation, '%S')) jobField.grid(row=2, column=1, sticky="W", padx=5, pady=5) #Buttons okButton = tk.Button(mainWindow, text="OK", width=10, height=2, font=("Arial"), command=eventOkButton) okButton.grid(row=3, column=0, padx=10, pady=10) cancelButton = tk.Button(mainWindow, text="CLOSE", width=10, height=2, font=("Arial"), command=lambda: sgf.eventCloseButton(mainWindow)) cancelButton.grid(row=3, column=1, padx=10, pady=10) #Should be always in the end of the file mainWindow.mainloop()