Open baumbachb opened 3 years ago
import tkinter
service = { #This is the dictionary that holds all of the services and their associated prices '1':3000, '2':2000, '3':5000, '4':3500, '5':4000, '6':6000, '': 0, '# of employees': 0 }
services = [ #This is the list that holds all of the services (Used for the GUI output) '1. Mergers and Acquisitions', '2. Business Valuations', '3. Financial Analysis & Operational Ideas', '4. Strategic Planning Services', '5. Specialized Strategic Consultion Services', '6. Litigation Support' ]
window = tkinter.Tk() #Creates the window (GUI)
class QuotaCalc:
## A class that asks for data about a client and then calculates
## both the time required for the service and the total estimate cost
def __init__(self, main, cust_name = 'none', co_size = 0, option1=None, option2=None, option3=None, option_label = None): ##This initializes the class with all of the variables that we will use
self.co_name = tkinter.Label(main, text = 'Customer/Company Name', font=('Time New Roman', 16)).grid(row=20, column=1) #This displays text, the font is the font, and this tells the program what to display
self.co_name_input = tkinter.Entry(main).grid(row=20, column=3) #Allows user to input information #by putting both on row 0, it alligns the text
comp_size_input = tkinter.IntVar() #Initializing the variable comp_size_input, to be called later in the myClicker function for the calculation
self.co_size = tkinter.Label(main, text = 'Company Size', font=('Time New Roman', 16)).grid(row=40, column=1) #Company Size Label
self.comp_size_input = tkinter.Entry(main) #Company Size Input Box
self.comp_size_input.grid(row=40, column=3)
self.comp_size_input.insert(0, "# of employees")
self.space2 = tkinter.Label(main, text = '').grid(row = 59, column = 1)
self.option_label = tkinter.Label(main, text = 'Available Services:', font=('Time New Roman', 16)).grid(row=60, column=1)
self.service1 = tkinter.Label(main, text = services[0], font=('Time New Roman', 12), justify ='left').grid(row=61, column=1)
self.service2 = tkinter.Label(main, text = services[1], font=('Time New Roman', 12), justify = 'left').grid(row=62, column=1)
self.service3 = tkinter.Label(main, text = services[2], font=('Time New Roman', 12), justify = 'left').grid(row=63, column=1)
self.service4 = tkinter.Label(main, text = services[3], font=('Time New Roman', 12), justify = 'left').grid(row=64, column=1)
self.service5 = tkinter.Label(main, text = services[4], font=('Time New Roman', 12), justify = 'left').grid(row=65, column=1)
self.service6 = tkinter.Label(main, text = services[5], font=('Time New Roman', 12), justify = 'left').grid(row=66, column=1)
self.space = tkinter.Label(main, text = '').grid(row=67, column = 1)
self.select = tkinter.Label(main, text = 'Selected Service(s)', font=('Time New Roman', 16)).grid(row=60, column=3)
drop = tkinter.StringVar()
self.drop = tkinter.Entry(main)
self.drop.grid(row= 61, column = 3)
self.drop.insert(0, "# of the service")
drop2 = tkinter.StringVar()
self.drop2 = tkinter.Entry(main)
self.drop2.grid(row= 63, column = 3)
self.drop2.insert(0,"# of the service")
drop3 = tkinter.StringVar()
self.drop3 = tkinter.Entry(main)
self.drop3.grid(row= 65, column = 3)
self.drop3.insert(0, "# of the service")
timeRequired = 0 #Initializing the variable timeRequired #Packing the Company Size Label
self.bt = tkinter.Button(main, text='Calculate', command = self.myClick, fg = "purple", bg = "light blue").grid(row=120, column=2) #Creates the Calculate button to run the code that finds the total cost and time required ##fg is foreground (color), bg is background (color)
#Need to convert to when the button presses, it runs other functions of the class
time_req = tkinter.Label(window, text = 'Time Required',
font=('Time New Roman', 16)
).grid(row=140, column=1) #Creates the label Time Required to describe the output
total_cost = tkinter.Label(window,
text = 'Price Quote',
font=('Time New Roman', 16)
).grid(row=160, column=1) #Creates the label Total Cost to describe the output
def myClick(self): #A function that activates once the button has been clicked and is desigend to calculate the total cost and time required for the services and output it to the GUI
comp_size = self.comp_size_input.get() #Initalizes the variable copm_size to be used in the time required calcuation
comp_size = int(comp_size) #Converts the variable comp size into an int
drop = str(self.drop.get()) #Initializes and converts the chosen options for services 1, 2, and 3 into a string so they can be used to look up the prices in the service dictionary
drop2 = str(self.drop2.get())
drop3 = str(self.drop3.get())
timeRequired = 0
cost = 0
if comp_size == 0: #This determines how much time will be necessary based on the size of the company
timeRequired = 0 #Need to add data validation for the company size
elif comp_size <= 20:
timeRequired = 1
elif comp_size <= 40:
timeRequired = 2
elif comp_size <= 60:
timeRequired = 3
elif comp_size <= 80:
timeRequired = 4
elif comp_size <= 100:
timeRequired = 5
elif comp_size <= 150:
timeRequired = 6
else:
timeRequired = 8
if drop in service and drop2 in service and drop3 in service:
cost = timeRequired * service[drop] #This section is used to determine the total costs based off of the services and the amount of time for the all the services
if drop2 != '':
cost += timeRequired * service[drop2]
if drop3 != '':
cost += timeRequired * service[drop3]
self.myLabel = tkinter.Label(window,
text = '{} Months'.format(timeRequired)
, font=('Time New Roman', 16),
bd=1, relief = 'sunken') #Designed to show the total time required and the total cost outputted on the GUI screen
self.myLabel.grid(row=140, column=3)
self.myLabel2 = tkinter.Label(window,
text ='${:,.2f} Dollars'.format(cost),
font=('Time New Roman', 16),
bd=1, relief = 'sunken')
self.myLabel2.grid(row=160, column=3)
else:
self.myLabel3 = tkinter.Label(window,
text = 'Please enter a number that corresponds to a service'
, font=('Time New Roman', 12),
bd=1, relief = 'sunken') #Designed to show the total time required and the total cost outputted on the GUI screen
self.myLabel3.grid(row=140, column=2)
logo = tkinter.PhotoImage(file=r"C:\Users\brian\OneDrive\Documents\TCU\Junior Year\Second Semester\Business Information System Development INSC 30833\Bar Ad Pic.PNG")
w1 = tkinter.Label(window, image=logo).grid(row=0, column = 2) #Displays the picture at this grid coordinate
window.title('Barrington Advisory Quota Calculator') #Window Title window.geometry('850x500') #Sets the size of the window
e = QuotaCalc(window)
window.mainloop() #Tells the program to continue running until the GUI is closed
import tkinter
service = { #This is the dictionary that holds all of the services and their associated prices '1':3000, '2':2000, '3':5000, '4':3500, '5':4000, '6':6000, '': 0 }
services = [ #This is the list that holds all of the services (Used for the GUI output) '1. Mergers and Acquisitions', '2. Business Valuations', '3. Financial Analysis & Operational Ideas', '4. Strategic Planning Services', '5. Specialized Strategic Consultion Services', '6. Litigation Support' ]
window = tkinter.Tk() #Creates the window (GUI)
class QuotaCalc:
can add in blank lables to space out the boxes (reduce the font to something small) on the GUI
logo = tkinter.PhotoImage(file=r"C:\Users\brian\OneDrive\Documents\TCU\Junior Year\Second Semester\Business Information System Development INSC 30833\Bar Ad Pic.PNG")
YOU MUST USE THE FILE PATH TO THE LOGO ON YOUR OWN COMPUTER
THIS SHOWS MY PERSONAL FILE PATH
w1 = tkinter.Label(window, image=logo).grid(row=0, column = 2) #Displays the picture at this grid coordinate
window.title('Barrington Advisory Quota Calculator') #Window Title window.geometry('1000x500') #Sets the size of the window
window.configure(bg='light blue') <- If we want to change the color of the background
e = QuotaCalc(window)
window.mainloop() #Tells the program to continue running until the GUI is closed