The final exam will be held on Thursday, December 22nd from 3 to 6 PM.
The exam will be given in this room.
If for some reason you are not able to take the Final at the time it will be offered, you MUST send an email to me before the exam so we can make alternative arrangements.
The final will consist of questions like those on the quizzes, along with questions asking you to write short segments of Python code.
60% of the points on this exam will consist of questions from the Ungraded Class Quizzes.
The remaining 40% will come from 4 questions that ask you to write some code.
The last class on Tuesday, December 13th, will be a review session.
You will only be responsible for the material in that review session and the review for the Midterm, which you will find here.
There will be no class on what would normally be the last day of class, Tuesday, May 10th.
But I will be in this classroom at the regular time for any student who needs additional help.
This should give you a week to study for the final.
Although the time alloted for the exam is 3 hours, I would expect that most of you would not need that much time.
The final is a closed book exam.
To prevent cheating, certain rules will be enforced during the exam.
At the end of each semester we offer you the opportunity to say what you think about this course.
What have I done right?
What have I done wrong?
What can I do better?
You are not asked for you name.
So the submissions are anonymous.
I will not see your responses until after I have submitted grades for this course.
We collect this feedback through Course Evaluations.
I will use what you say to make this course better.
To complete the course evalutaion, use the following link .
You have until Wednesday, December 21st, to submit the evaluation.
from tkinter import *
class PackTestWindow:
def __init__(self):
self.root= Tk()
self.root.title("Pack Test")
mainloop()
root = PackTestWindow()
class PackTestWindow:
def __init__(self):
self.root= Tk()
self.root.title("Pack Test")
self.l1 = Label(self.root, text="First label", fg="red")
self.l1.pack()
mainloop()
root = PackTestWindow()
self.l2 = Label(self.root, text="Second label", fg="green") self.l2.pack()
self.l3 = Label(self.root, text="Third label", fg="blue") self.l3.pack()
self.l1 = Label(self.root, text="First label", fg="red")
self.l1.pack(side="left")
self.l2 = Label(self.root, text="Second label", fg="green")
self.l2.pack(side="left")
self.l3 = Label(self.root, text="Third label", fg="blue")
self.l3.pack(side="left")
class FrameWindow:
def __init__(self):
self.root= Tk()
self.root.title("Frame Test")
self.top_frame = Frame(self.root)
self.bottom_frame = Frame(self.root)
self.top_frame.pack()
self.bottom_frame.pack(
self.l1 = Label(self.top_frame, text="Red label", fg="red")
self.l1.pack(side="top")
self.l2 = Label(self.top_frame, text="Green label", fg="green")
self.l2.pack(side="top")
self.l3 = Label(self.top_frame, text="Blue label", fg="blue")
self.l3.pack(side="top")
self.l4 = Label(self.bottom_frame, text="Magenta label", fg="magenta")
self.l4.pack(side="left")
self.l5 = Label(self.bottom_frame, text="Cyan label", fg="cyan")
self.l5.pack(side="left")
class GridWindow:
def __init__(self):
self.root= Tk()
self.root.title("Grid Test")
self.l1 = Label(self.root, text="Red", fg="red")
self.l1.grid(row=0, column=0)
self.l2 = Label(self.root, text="Green", fg="green")
self.l2.grid(row=0, column=1)
self.l3 = Label(self.root, text="Blue", fg="blue")
self.l3.grid(row=1, column=0)
self.l4 = Label(self.root, text="Magenta", fg="magenta")
self.l4.grid(row=1, column=1)
mainloop()
from tkinter import *
class ButtonWindow:
def __init__(self):
self.root= Tk()
self.root.title("Button Test")
self.button = Button(self.root, text="Quit", command=quit)
self.button.pack()
mainloop()
root = ButtonWindow()
from tkinter import *
class ButtonWindow:
def __init__(self):
self.root= Tk()
self.root.title("Button Test")
self.button = Button(self.root, text="Click for showinfo box", command=self.action)
self.button.pack()
mainloop()
def action(self):
messagebox.showinfo("Show Info", "This is a message box created by showinfo")
miles = kilometers * 0.6214
self.root= Tk()
self.root.title("Kilometers to Miles")
# top frame
self.top_frame = Frame(self.root)
self.prompt_label = \
Label(self.top_frame, text="Enter a distance in kilometers:')
self.kilo_entry = Entry(self.top_frame, width=10)
self.prompt_label.pack(side="left')
self.kilo_entry.pack(side="left')
self.top_frame.pack()
# bottom frame
self.bottom_frame = Frame(self.root)
self.calc_button = \
Button(self.bottom_frame, text="Convert', command=self.convert)
self.quit_button = Button(self.bottom_frame, text="Quit', command=self.root.destroy)
self.calc_button.pack(side="left')
self.quit_button.pack(side="left')
self.bottom_frame.pack()
def convert(self):
kilo = round(float(self.kilo_entry.get()), 2)
miles = round(kilo * 0.6214, 2)
messagebox.showinfo('Results', \
str(kilo) + ' kilometers is equal to ' + \
str(miles) + ' miles.')
float valueself.label = Label(self.main_window, text="Hello, world!")
self.miles = StringVar()
self.miles_label = Label(self.mid_frame, textvariable=self.miles)
# mid frame
self.mid_frame = Frame(self.root)
self.descr_label = Label(self.mid_frame, text="Converted to miles:')
self.miles = StringVar()
self.miles_label = Label(self.mid_frame, textvariable=self.miles)
self.descr_label.pack(side="left')
self.miles_label.pack(side="left')
self.mid_frame.pack()
def convert(self):
kilo = float(self.kilo_entry.get())
miles = round(kilo * 0.6214, 2)
self.miles.set(miles)
self.top_frame = Frame(self.root)
self.language_var = StringVar()
self.language_var.set('English')
self.rb1 = Radiobutton(self.top_frame, \
text="English', variable=self.language_var, \
value="English', command=self.show_choice)
self.rb2 = Radiobutton(self.top_frame, \
text="Spanish', variable=self.language_var, \
value="Spanish', command=self.show_choice)
self.rb3 = Radiobutton(self.top_frame, \
text="French', variable=self.language_var, \
value="French', command=self.show_choice)
self.rb4 = Radiobutton(self.top_frame, \
text="Arabic', variable=self.language_var, \
value="Arabic', command=self.show_choice)
def show_choice(self):
language = self.language_var.get()
self.value.set(language)
self.cb_var1 = BooleanVar()
self.cb_var2 = BooleanVar()
self.cb_var3 = BooleanVar()
False
self.cb_var1.set(False)
self.cb_var2.set(False)
self.cb_var3.set(False)
self.cb1 = Checkbutton(self.top_frame, text="Oil change', \
variable=self.cb_var1, command=self.show_choice)
self.cb2 = Checkbutton(self.top_frame, text="Inspection', \
variable=self.cb_var2, command=self.show_choice)
self.cb3 = Checkbutton(self.top_frame, text="Tire rotation', \
variable=self.cb_var3, command=self.show_choice)
def show_choice(self):
choices = []
if self.cb_var1.get():
choices.append('Oil change')
if self.cb_var2.get():
choices.append('Inspection')
if self.cb_var3.get():
choices.append('Tire rotation')
choice_list = ''
for choice in choices:
choice_list += choice + '\n'
self.value.set(choice_list)