Skip to content

Commit d944cc8

Browse files
committed
added Tell Me Where App
an app for the delivery persons which will help them reach the destination precisely
1 parent b23583b commit d944cc8

File tree

454 files changed

+29216
-31979
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

454 files changed

+29216
-31979
lines changed

AddressBook.py

+124-124
Original file line numberDiff line numberDiff line change
@@ -1,124 +1,124 @@
1-
import pickle
2-
import os.path
3-
from tkinter import * # Import tkinter
4-
import tkinter.messagebox
5-
6-
class Address:
7-
def __init__(self, name, street, city, state, zip):
8-
self.name = name
9-
self.street = street
10-
self.city = city
11-
self.state = state
12-
self.zip = zip
13-
14-
class AddressBook:
15-
def __init__(self):
16-
window = Tk() # Create a window
17-
window.title("AddressBook") # Set title
18-
19-
self.nameVar = StringVar()
20-
self.streetVar = StringVar()
21-
self.cityVar = StringVar()
22-
self.stateVar = StringVar()
23-
self.zipVar = StringVar()
24-
25-
frame1 = Frame(window)
26-
frame1.pack()
27-
Label(frame1, text = "Name").grid(row = 1,
28-
column = 1, sticky = W)
29-
Entry(frame1, textvariable = self.nameVar,
30-
width = 40).grid(row = 1, column = 2)
31-
32-
frame2 = Frame(window)
33-
frame2.pack()
34-
Label(frame2, text = "Street").grid(row = 1,
35-
column = 1, sticky = W)
36-
Entry(frame2, textvariable = self.streetVar,
37-
width = 40).grid(row = 1, column = 2)
38-
39-
frame3 = Frame(window)
40-
frame3.pack()
41-
Label(frame3, text = "City", width = 5).grid(row = 1,
42-
column = 1, sticky = W)
43-
Entry(frame3,
44-
textvariable = self.cityVar).grid(row = 1, column = 2)
45-
Label(frame3, text = "State").grid(row = 1,
46-
column = 3, sticky = W)
47-
Entry(frame3, textvariable = self.stateVar,
48-
width = 5).grid(row = 1, column = 4)
49-
Label(frame3, text = "ZIP").grid(row = 1,
50-
column = 5, sticky = W)
51-
Entry(frame3, textvariable = self.zipVar,
52-
width = 5).grid(row = 1, column = 6)
53-
54-
frame4 = Frame(window)
55-
frame4.pack()
56-
Button(frame4, text = "Add",
57-
command = self.processAdd).grid(row = 1, column = 1)
58-
btFirst = Button(frame4, text = "First",
59-
command = self.processFirst).grid(row = 1, column = 2)
60-
btNext = Button(frame4, text = "Next",
61-
command = self.processNext).grid(row = 1, column = 3)
62-
btPrevious = Button(frame4, text = "Previous", command =
63-
self.processPrevious).grid(row = 1, column = 4)
64-
btLast = Button(frame4, text = "Last",
65-
command = self.processLast).grid(row = 1, column = 5)
66-
67-
self.addressList = self.loadAddress()
68-
self.current = 0
69-
70-
if len(self.addressList) > 0:
71-
self.setAddress()
72-
73-
window.mainloop() # Create an event loop
74-
75-
def saveAddress(self):
76-
outfile = open("address.dat", "wb")
77-
pickle.dump(self.addressList, outfile)
78-
tkinter.messagebox.showinfo(
79-
"Address saved", "A new address is saved")
80-
outfile.close()
81-
82-
def loadAddress(self):
83-
if not os.path.isfile("address.dat"):
84-
return [] # Return an empty list
85-
86-
try:
87-
infile = open("address.dat", "rb")
88-
addressList = pickle.load(infile)
89-
except EOFError:
90-
addressList = []
91-
92-
infile.close()
93-
return addressList
94-
95-
def processAdd(self):
96-
address = Address(self.nameVar.get(),
97-
self.streetVar.get(), self.cityVar.get(),
98-
self.stateVar.get(), self.zipVar.get())
99-
self.addressList.append(address)
100-
self.saveAddress()
101-
102-
def processFirst(self):
103-
self.current = 0
104-
self.setAddress()
105-
106-
def processNext(self):
107-
if self.current < len(self.addressList) - 1:
108-
self.current += 1
109-
self.setAddress()
110-
111-
def processPrevious(self):
112-
pass # Left as exercise
113-
114-
def processLast(self):
115-
pass # Left as exercise
116-
117-
def setAddress(self):
118-
self.nameVar.set(self.addressList[self.current].name)
119-
self.streetVar.set(self.addressList[self.current].street)
120-
self.cityVar.set(self.addressList[self.current].city)
121-
self.stateVar.set(self.addressList[self.current].state)
122-
self.zipVar.set(self.addressList[self.current].zip)
123-
124-
AddressBook() # Create GUI
1+
import pickle
2+
import os.path
3+
from tkinter import * # Import tkinter
4+
import tkinter.messagebox
5+
6+
class Address:
7+
def __init__(self, name, street, city, state, zip):
8+
self.name = name
9+
self.street = street
10+
self.city = city
11+
self.state = state
12+
self.zip = zip
13+
14+
class AddressBook:
15+
def __init__(self):
16+
window = Tk() # Create a window
17+
window.title("AddressBook") # Set title
18+
19+
self.nameVar = StringVar()
20+
self.streetVar = StringVar()
21+
self.cityVar = StringVar()
22+
self.stateVar = StringVar()
23+
self.zipVar = StringVar()
24+
25+
frame1 = Frame(window)
26+
frame1.pack()
27+
Label(frame1, text = "Name").grid(row = 1,
28+
column = 1, sticky = W)
29+
Entry(frame1, textvariable = self.nameVar,
30+
width = 40).grid(row = 1, column = 2)
31+
32+
frame2 = Frame(window)
33+
frame2.pack()
34+
Label(frame2, text = "Street").grid(row = 1,
35+
column = 1, sticky = W)
36+
Entry(frame2, textvariable = self.streetVar,
37+
width = 40).grid(row = 1, column = 2)
38+
39+
frame3 = Frame(window)
40+
frame3.pack()
41+
Label(frame3, text = "City", width = 5).grid(row = 1,
42+
column = 1, sticky = W)
43+
Entry(frame3,
44+
textvariable = self.cityVar).grid(row = 1, column = 2)
45+
Label(frame3, text = "State").grid(row = 1,
46+
column = 3, sticky = W)
47+
Entry(frame3, textvariable = self.stateVar,
48+
width = 5).grid(row = 1, column = 4)
49+
Label(frame3, text = "ZIP").grid(row = 1,
50+
column = 5, sticky = W)
51+
Entry(frame3, textvariable = self.zipVar,
52+
width = 5).grid(row = 1, column = 6)
53+
54+
frame4 = Frame(window)
55+
frame4.pack()
56+
Button(frame4, text = "Add",
57+
command = self.processAdd).grid(row = 1, column = 1)
58+
btFirst = Button(frame4, text = "First",
59+
command = self.processFirst).grid(row = 1, column = 2)
60+
btNext = Button(frame4, text = "Next",
61+
command = self.processNext).grid(row = 1, column = 3)
62+
btPrevious = Button(frame4, text = "Previous", command =
63+
self.processPrevious).grid(row = 1, column = 4)
64+
btLast = Button(frame4, text = "Last",
65+
command = self.processLast).grid(row = 1, column = 5)
66+
67+
self.addressList = self.loadAddress()
68+
self.current = 0
69+
70+
if len(self.addressList) > 0:
71+
self.setAddress()
72+
73+
window.mainloop() # Create an event loop
74+
75+
def saveAddress(self):
76+
outfile = open("address.dat", "wb")
77+
pickle.dump(self.addressList, outfile)
78+
tkinter.messagebox.showinfo(
79+
"Address saved", "A new address is saved")
80+
outfile.close()
81+
82+
def loadAddress(self):
83+
if not os.path.isfile("address.dat"):
84+
return [] # Return an empty list
85+
86+
try:
87+
infile = open("address.dat", "rb")
88+
addressList = pickle.load(infile)
89+
except EOFError:
90+
addressList = []
91+
92+
infile.close()
93+
return addressList
94+
95+
def processAdd(self):
96+
address = Address(self.nameVar.get(),
97+
self.streetVar.get(), self.cityVar.get(),
98+
self.stateVar.get(), self.zipVar.get())
99+
self.addressList.append(address)
100+
self.saveAddress()
101+
102+
def processFirst(self):
103+
self.current = 0
104+
self.setAddress()
105+
106+
def processNext(self):
107+
if self.current < len(self.addressList) - 1:
108+
self.current += 1
109+
self.setAddress()
110+
111+
def processPrevious(self):
112+
pass # Left as exercise
113+
114+
def processLast(self):
115+
pass # Left as exercise
116+
117+
def setAddress(self):
118+
self.nameVar.set(self.addressList[self.current].name)
119+
self.streetVar.set(self.addressList[self.current].street)
120+
self.cityVar.set(self.addressList[self.current].city)
121+
self.stateVar.set(self.addressList[self.current].state)
122+
self.zipVar.set(self.addressList[self.current].zip)
123+
124+
AddressBook() # Create GUI

AnimationDemo.py

+32-32
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
1-
from tkinter import * # Import tkinter
2-
3-
class AnimationDemo:
4-
def __init__(self):
5-
window = Tk() # Create a window
6-
window.title("Animation Demo") # Set a title
7-
8-
width = 250 # Width of the canvas
9-
canvas = Canvas(window, bg = "white",
10-
width = 250, height = 50)
11-
canvas.pack()
12-
13-
x = 0 # Starting x position
14-
canvas.create_text(x, 30,
15-
text = "Message moving?", tags = "text")
16-
17-
dx = 3
18-
while True:
19-
canvas.move("text", dx, 0) # Move text dx unit
20-
canvas.after(100) # Sleep for 100 milliseconds
21-
canvas.update() # Update canvas
22-
if x < width:
23-
x += dx # Get the current position for string
24-
else:
25-
x = 0 # Reset string position to the beginning
26-
canvas.delete("text")
27-
# Redraw text at the beginning
28-
canvas.create_text(x, 30, text = "Message moving?",
29-
tags = "text")
30-
31-
window.mainloop() # Create an event loop
32-
1+
from tkinter import * # Import tkinter
2+
3+
class AnimationDemo:
4+
def __init__(self):
5+
window = Tk() # Create a window
6+
window.title("Animation Demo") # Set a title
7+
8+
width = 250 # Width of the canvas
9+
canvas = Canvas(window, bg = "white",
10+
width = 250, height = 50)
11+
canvas.pack()
12+
13+
x = 0 # Starting x position
14+
canvas.create_text(x, 30,
15+
text = "Message moving?", tags = "text")
16+
17+
dx = 3
18+
while True:
19+
canvas.move("text", dx, 0) # Move text dx unit
20+
canvas.after(100) # Sleep for 100 milliseconds
21+
canvas.update() # Update canvas
22+
if x < width:
23+
x += dx # Get the current position for string
24+
else:
25+
x = 0 # Reset string position to the beginning
26+
canvas.delete("text")
27+
# Redraw text at the beginning
28+
canvas.create_text(x, 30, text = "Message moving?",
29+
tags = "text")
30+
31+
window.mainloop() # Create an event loop
32+
3333
AnimationDemo() # Create GUI

BMI.py

+37-37
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
1-
class BMI:
2-
def __init__(self, name, age, weight, height):
3-
self.__name = name
4-
self.__age = age
5-
self.__weight = weight
6-
self.__height = height
7-
8-
def getBMI(self):
9-
KILOGRAMS_PER_POUND = 0.45359237
10-
METERS_PER_INCH = 0.0254
11-
bmi = self.__weight * KILOGRAMS_PER_POUND / \
12-
((self.__height * METERS_PER_INCH) * \
13-
(self.__height * METERS_PER_INCH))
14-
return round(bmi * 100) / 100
15-
16-
def getStatus(self):
17-
bmi = self.getBMI()
18-
if bmi < 18.5:
19-
return "Underweight"
20-
elif bmi < 25:
21-
return "Normal"
22-
elif bmi < 30:
23-
return "Overweight"
24-
else:
25-
return "Obese"
26-
27-
def getName(self):
28-
return self.__name
29-
30-
def getAge(self):
31-
return self.__age
32-
33-
def getWeight(self):
34-
return self.__weight
35-
36-
def getHeight(self):
37-
return self.__height
1+
class BMI:
2+
def __init__(self, name, age, weight, height):
3+
self.__name = name
4+
self.__age = age
5+
self.__weight = weight
6+
self.__height = height
7+
8+
def getBMI(self):
9+
KILOGRAMS_PER_POUND = 0.45359237
10+
METERS_PER_INCH = 0.0254
11+
bmi = self.__weight * KILOGRAMS_PER_POUND / \
12+
((self.__height * METERS_PER_INCH) * \
13+
(self.__height * METERS_PER_INCH))
14+
return round(bmi * 100) / 100
15+
16+
def getStatus(self):
17+
bmi = self.getBMI()
18+
if bmi < 18.5:
19+
return "Underweight"
20+
elif bmi < 25:
21+
return "Normal"
22+
elif bmi < 30:
23+
return "Overweight"
24+
else:
25+
return "Obese"
26+
27+
def getName(self):
28+
return self.__name
29+
30+
def getAge(self):
31+
return self.__age
32+
33+
def getWeight(self):
34+
return self.__weight
35+
36+
def getHeight(self):
37+
return self.__height

Billing-System

-1
This file was deleted.

0 commit comments

Comments
 (0)