jakehennes / the-a-team

0 stars 0 forks source link

Tkinker #1

Open baumbachb opened 3 years ago

baumbachb commented 3 years ago

This is just a rough draft of learning Tkinker

import tkinter

window = tkinter.Tk() #Creates the window (GUI)

window.title('Barrington Advisory Quota Calculator') #Window Title window.geometry('1000x500') #Sets the size of the window

label = tkinter.Label(window, text = '', font=('Arial Narrow', 20)).grid(row=0, column=1) #This displays text, the font is the font, and this tells the program what to display

tkinter.Entry(window).grid(row = 0, column=30) #Allows user to input information #by putting both on row 0, it alligns the text

bt = tkinter.Button(window, text='Calculate', fg = "purple", bg = "light blue").grid(row=8, column = 6) ##fg is foreground (color), bg is background (color)

Will be used for the actual "press" to calculate

window.mainloop() #Tells the program to continue running until the GUI is closed

baumbachb commented 3 years ago

Here are my updates to the code:

import tkinter

window = tkinter.Tk() #Creates the window (GUI)

window.title('Barrington Advisory Quota Calculator') #Window Title window.geometry('1000x500') #Sets the size of the window

name = tkinter.Label(window, text = 'Customer/Company Name', font=('Arial Narrow', 20)).grid(row=0, column=1) #This displays text, the font is the font, and this tells the program what to display tkinter.Entry(window).grid(row = 0, column=75) #Allows user to input information #by putting both on row 0, it alligns the text

size = tkinter.Label(window, text = 'Company Size', font=('Arial Narrow', 20)).grid(row=20, column=1) tkinter.Entry(window).grid(row = 20, column=75)

option = tkinter.Label(window, text = 'Service 1 Needed', font=('Arial Narrow', 20)).grid(row=40, column=1)
tkinter.Entry(window).grid(row = 40, column=75)

option2 = tkinter.Label(window, text = 'Service 2 Needed', font=('Arial Narrow', 20)).grid(row=60, column=1) tkinter.Entry(window).grid(row = 60, column=75)

option3 = tkinter.Label(window, text = 'Service 3 Needed', font=('Arial Narrow', 20)).grid(row=80, column=1) tkinter.Entry(window).grid(row = 80, column=75)

bt = tkinter.Button(window, text='Calculate', fg = "purple", bg = "light blue").grid(row=150, column = 25) ##fg is foreground (color), bg is background (color)

Will be used for the actual "press" to calculate

window.mainloop() #Tells the program to continue running until the GUI is closed

baumbachb commented 3 years ago

Even further updates:

Still need to convert the text boxes from just empty boxes to dropdown menus (for the options)

Still need to import the picture for the code

Still need to connect the calculate button to the actual code

import tkinter

service = { 'Mergers and Acquisitions':3000, 'Business Valuations':2000, 'Financial Analysis & Operational Ideas':5000, 'Strategic Planning Services':3500, 'Specialized Strategic Consultion Services':4000, 'Litigation Support':6000, '': 0 }

import Tkinter.docx import Tkinter.docx

window = tkinter.Tk() #Creates the window (GUI)

window.title('rrBaington Advisory Quota Calculator') #Window Title window.geometry('400x325') #Sets the size of the window

window.configure(bg='light blue') <- If we want to change the color of the background

We need to import the Barrington Advisory Photo into the application as well

name = tkinter.Label(window, text = 'Customer/Company Name', font=('Arial Narrow', 20)).grid(row=40, column=10) #This displays text, the font is the font, and this tells the program what to display tkinter.Entry(window).grid(row = 40, column=85) #Allows user to input information #by putting both on row 0, it alligns the text

size = tkinter.Label(window, text = 'Company Size', font=('Arial Narrow', 20)).grid(row=60, column=10) tkinter.Entry(window).grid(row = 60, column=85)

Everything for the next 25 lines or so is me trying to make the text boxes into dropdown menus

def show(): label.config( text = clicked.get() )

datatype of menu text

clicked = StringVar

initial menu text

clicked.set( "" )

Create Dropdown menu

drop = OptionMenu( window , clicked , *service ) drop.pack()

Create button, it will change label text

button = tkinter.Button( window , text = "Services" , command = show ).pack()

Create Label

dropdown =tkinter.Label( window , text = " " ).pack()

Everything below was for the input text boxes, I am currently trying to make these into

Dropdown menus, so I have the commented out & Im working on the dropdown menus above

''' option = tkinter.Label(window, text = 'Service 1 Needed', font=('Arial Narrow', 20)).grid(row=80, column=10)
tkinter.Entry(window).grid(row = 80, column=85)

option2 = tkinter.Label(window, text = 'Service 2 Needed', font=('Arial Narrow', 20)).grid(row=100, column=10) tkinter.Entry(window).grid(row = 100, column=85)

option3 = tkinter.Label(window, text = 'Service 3 Needed', font=('Arial Narrow', 20)).grid(row=120, column=10) tkinter.Entry(window).grid(row = 120, column=85) '''

bt = tkinter.Button(window, text='Calculate', fg = "purple", bg = "light blue").grid(row=150, column = 25) ##fg is foreground (color), bg is background (color)

Will be used for the actual "press" to calculate

time_req = tkinter.Label(window, text = 'Time Required', font=('Arial Narrow', 20)).grid(row=175, column=10)

Will have to link the python code to here - likely a

total_cost = tkinter.Label(window, text = 'Price Quote', font=('Arial Narrow', 20)).grid(row=200, column=10)

Will have to link the python code to here - i belive it would be the calc.calcCost

window.mainloop() #Tells the program to continue running until the GUI is closed

baumbachb commented 3 years ago

This is the code that I have made for all of the labels and dropdowns

We still need to import the Barrington Advisory photo for this

We still need to connect this to the code to run any of the inputs

import tkinter

service = [ '', 'Mergers and Acquisitions', 'Business Valuations', 'Financial Analysis & Operational Ideas', 'Strategic Planning Services', 'Specialized Strategic Consultion Services', 'Litigation Support' ]

window = tkinter.Tk() #Creates the window (GUI)

window.title('rrBaington Advisory Quota Calculator') #Window Title window.geometry('400x325') #Sets the size of the window

window.configure(bg='light blue') <- If we want to change the color of the background

name = tkinter.Label(window, text = 'Customer/Company Name', font=('Arial Narrow', 20)).grid(row=40, column=10) #This displays text, the font is the font, and this tells the program what to display tkinter.Entry(window).grid(row = 40, column=85) #Allows user to input information #by putting both on row 0, it alligns the text

size = tkinter.Label(window, text = 'Company Size', font=('Arial Narrow', 20)).grid(row=60, column=10) tkinter.Entry(window).grid(row = 60, column=85)

clicked = tkinter.StringVar() #initalizing "clicked" as a string variable

clicked.set(service[0]) #Text to be displayed on the menu dropdown

option = tkinter.Label(window, text = 'Service 1 Needed', font=('Arial Narrow', 20)).grid(row=80, column=10)
drop = tkinter.OptionMenu( window , clicked , *service ).grid(row = 80, column=85) #refers to the set number of services for dropdown

option2 = tkinter.Label(window, text = 'Service 2 Needed', font=('Arial Narrow', 20)).grid(row=100, column=10) drop2 = tkinter.OptionMenu( window , clicked , *service ).grid(row = 100, column=85)

option3 = tkinter.Label(window, text = 'Service 3 Needed', font=('Arial Narrow', 20)).grid(row=120, column=10) drop3 = tkinter.OptionMenu( window , clicked , *service ).grid(row = 120, column=85)

bt = tkinter.Button(window, text='Calculate', fg = "purple", bg = "light blue").grid(row=150, column = 25) ##fg is foreground (color), bg is background (color)

Will be used for the actual "press" to calculate

time_req = tkinter.Label(window, text = 'Time Required', font=('Arial Narrow', 20)).grid(row=175, column=10)

Will have to link the python code to here - likely a

total_cost = tkinter.Label(window, text = 'Price Quote', font=('Arial Narrow', 20)).grid(row=200, column=10)

Will have to link the python code to here - i belive it would be the calc.calcCost

window.mainloop() #Tells the program to continue running until the GUI is closed

baumbachb commented 3 years ago

This was me trying to connect the code and the Tkinter interface, it is not finished/working though:

'''

Barrington Advisory Solutions BIS Development Team Project

'''

import tkinter

service = { #This is the dictionary that holds all of the services and their associated prices 'Mergers and Acquisitions':3000, 'Business Valuations':2000, 'Financial Analysis & Operational Ideas':5000, 'Strategic Planning Services':3500, 'Specialized Strategic Consultion Services':4000, 'Litigation Support':6000, '': 0 }

services = [ #This is the list that holds all of the services (Used for the GUI output) '', 'Mergers and Acquisitions', 'Business Valuations', 'Financial Analysis & Operational Ideas', 'Strategic Planning Services', 'Specialized Strategic Consultion Services', 'Litigation Support' ]

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, cust_name = 'none', co_size = 0, option1=None, option2=None, option3=None):      ##This initializes the class with all of the variables that we will use

    self.cust_name = cust_name
    self.co_size = co_size
    self.option1 = option1
    self.option2 = option2
    self.option3 = option3
    self.timeRequired = 0
    if co_size == 0:                        #This determines how much time will be necessary based on the size of the company
        self.timeRequired = 0
    elif co_size <= 20:
        self.timeRequired = 1
    elif co_size <= 40:
        self.timeRequired = 2
    elif co_size <= 60:
        self.timeRequired = 3
    elif co_size <= 80:
        self.timeRequired = 4
    elif co_size <= 100:
        self.timeRequired = 5
    elif co_size <= 150:
        self.timeRequired = 6
    else:
        self.timeRequired = 8

def getTime(self):
    return self.timeRequired

def calcCost(self):                                 #This calculates the total cost of the services
    cost = self.timeRequired * service[self.option1]
    if self.option2:
        cost += self.timeRequired * service[self.option2]
    if self.option3:
        cost += self.timeRequired * service[self.option3]

    return cost

window = tkinter.Tk() #Creates the window (GUI)

window.title('rrBaington Advisory Quota Calculator') #Window Title window.geometry('400x325') #Sets the size of the window

window.configure(bg='light blue') <- If we want to change the color of the background

co_name = tkinter.Label(window, text = 'Customer/Company Name', font=('Arial Narrow', 20)).grid(row=40, column=10) #This displays text, the font is the font, and this tells the program what to display tkinter.Entry(window).grid(row = 40, column=85) #Allows user to input information #by putting both on row 0, it alligns the text

comp_size = tkinter.Label(window, text = 'Company Size', font=('Arial Narrow', 20)).grid(row=60, column=10) tkinter.Entry(window).grid(row = 60, column=85)

clicked = tkinter.StringVar() #initalizing "clicked" as a string variable clicked2 = tkinter.StringVar() clicked3 = tkinter.StringVar()

clicked.set(services[0]) #Text to be displayed on the menu dropdown clicked2.set(services[0]) clicked3.set(services[0])

option_1 = tkinter.Label(window, text = 'Service 1 Needed', font=('Arial Narrow', 20)).grid(row=80, column=10)
drop = tkinter.OptionMenu( window , clicked , *service ).grid(row = 80, column=85) #refers to the set number of services for dropdown

option_2 = tkinter.Label(window, text = 'Service 2 Needed', font=('Arial Narrow', 20)).grid(row=100, column=10) drop2 = tkinter.OptionMenu( window , clicked2 , *service ).grid(row = 100, column=85)

option_3 = tkinter.Label(window, text = 'Service 3 Needed', font=('Arial Narrow', 20)).grid(row=120, column=10) drop3 = tkinter.OptionMenu( window , clicked3 , *service ).grid(row = 120, column=85)

bt = tkinter.Button(window, text='Calculate', fg = "purple", bg = "light blue").grid(row=150, column = 25) ##fg is foreground (color), bg is background (color)

Will be used for the actual "press" to calculate

time_req = tkinter.Label(window, text = 'Time Required', font=('Arial Narrow', 20)).grid(row=175, column=10)

Will have to link the python code to here - likely a

total_cost = tkinter.Label(window, text = 'Price Quote', font=('Arial Narrow', 20)).grid(row=200, column=10)

Will have to link the python code to here - i belive it would be the calc.calcCost

if name == "main":

print('Quota Calculator\n')

name = co_name           #input("Customer/Company Name: ")
size = comp_size      #int(input("Size of Company: ")) 
#while size <1 or size >200:     #need to check that is between 1-200
    #print("\nError! Company size must be between 1-200! Please enter a valid input...")            Has to be tunred into a GUI output
    #size = int(input("Size of Company: "))

option1 = option_1      #input("Service 1: ") #required
#while option1 not in service:
    #print("\nError! Please enter a valid service...")
    #option1 = input("Service 1: ") #required

option2 = option_2      #input("Service 2: ") #optional
#while option2 not in service:
    #print("\nError! Please enter a valid service...")
    #option2 = input("Service 2: ") #required

option3 = option_3      #input("Service 3: ") #optional
#while option3 not in service:
    #print("\nError! Please enter a valid service...")
    #option3 = input("Service 3: ") #required
#print("\nPrinting the results...\n")
# print(name)
# print(size)
# print(option1)
# print(option2)
# print(option3)

''' calc = QuotaCalc(name, size, option1, option2, option3) timeRequired = calc.getTime() time_required = tkinter.Label(window, text = timeRequired, font=('Arial Narrow', 20)).grid(row=175, column=85) #print("Time rquired: ", str(timeRequired) + " month(s)")

totalCost = calc.calcCost()
totalCost = format(totalCost, '.2f')
total_costs = tkinter.Label(window, text = 'Price Quote', font=('Arial Narrow', 20)).grid(row=200, column=85)    #print("Price quote: $", totalCost)

''' window.mainloop() #Tells the program to continue running until the GUI is closed

baumbachb commented 3 years ago

THIS IS AN INCOMPLETE POSTING OF THE TKINTER INTERFACE THAT IS POSETED TO HAVE THE DROPDOWNS BE UNIQUE

'''

Barrington Advisory Solutions BIS Development Team Project

'''

import tkinter

service = { #This is the dictionary that holds all of the services and their associated prices 'Mergers and Acquisitions':3000, 'Business Valuations':2000, 'Financial Analysis & Operational Ideas':5000, 'Strategic Planning Services':3500, 'Specialized Strategic Consultion Services':4000, 'Litigation Support':6000, '': 0 }

services = [ #This is the list that holds all of the services (Used for the GUI output) '', 'Mergers and Acquisitions', 'Business Valuations', 'Financial Analysis & Operational Ideas', 'Strategic Planning Services', 'Specialized Strategic Consultion Services', 'Litigation Support' ]

''' 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, cust_name = 'none', co_size = 0, option1=None, option2=None, option3=None):      ##This initializes the class with all of the variables that we will use

    self.cust_name = cust_name
    self.co_size = co_size
    self.option1 = option1
    self.option2 = option2
    self.option3 = option3
    self.timeRequired = 0
    if co_size == 0:                        #This determines how much time will be necessary based on the size of the company
        self.timeRequired = 0
    elif co_size <= 20:
        self.timeRequired = 1
    elif co_size <= 40:
        self.timeRequired = 2
    elif co_size <= 60:
        self.timeRequired = 3
    elif co_size <= 80:
        self.timeRequired = 4
    elif co_size <= 100:
        self.timeRequired = 5
    elif co_size <= 150:
        self.timeRequired = 6
    else:
        self.timeRequired = 8

def getTime(self):
    return self.timeRequired

def calcCost(self):                                 #This calculates the total cost of the services
    cost = self.timeRequired * service[self.option1]
    if self.option2:
        cost += self.timeRequired * service[self.option2]
    if self.option3:
        cost += self.timeRequired * service[self.option3]

    return cost

'''

window = tkinter.Tk() #Creates the window (GUI)

window.title('rrBaington Advisory Quota Calculator') #Window Title window.geometry('400x325') #Sets the size of the window

window.configure(bg='light blue') <- If we want to change the color of the background

co_name = tkinter.Label(window, text = 'Customer/Company Name', font=('Arial Narrow', 20)).grid(row=40, column=10) #This displays text, the font is the font, and this tells the program what to display tkinter.Entry(window).grid(row = 40, column=85) #Allows user to input information #by putting both on row 0, it alligns the text

comp_size = tkinter.Label(window, text = 'Company Size', font=('Arial Narrow', 20)).grid(row=60, column=10) tkinter.Entry(window).grid(row = 60, column=85)

clicked = tkinter.StringVar() #initalizing "clicked" as a string variable clicked2 = tkinter.StringVar() clicked3 = tkinter.StringVar()

clicked.set(services[0]) #Text to be displayed on the menu dropdown clicked2.set(services[0]) clicked3.set(services[0])

option_1 = tkinter.Label(window, text = 'Service 1 Needed', font=('Arial Narrow', 20)).grid(row=80, column=10)
drop = tkinter.OptionMenu( window , clicked , *service ).grid(row = 80, column=85) #refers to the set number of services for dropdown

option_2 = tkinter.Label(window, text = 'Service 2 Needed', font=('Arial Narrow', 20)).grid(row=100, column=10) drop2 = tkinter.OptionMenu( window , clicked2 , *service ).grid(row = 100, column=85)

option_3 = tkinter.Label(window, text = 'Service 3 Needed', font=('Arial Narrow', 20)).grid(row=120, column=10) drop3 = tkinter.OptionMenu( window , clicked3 , *service ).grid(row = 120, column=85)

bt = tkinter.Button(window, text='Calculate', fg = "purple", bg = "light blue").grid(row=150, column = 25) ##fg is foreground (color), bg is background (color)

Will be used for the actual "press" to calculate

time_req = tkinter.Label(window, text = 'Time Required', font=('Arial Narrow', 20)).grid(row=175, column=10)

Will have to link the python code to here - likely a

total_cost = tkinter.Label(window, text = 'Price Quote', font=('Arial Narrow', 20)).grid(row=200, column=10)

Will have to link the python code to here - i belive it would be the calc.calcCost

EVERYTHING BELOW IS FOR THE CONNECTION OF THE CODE TO TKINTER, THIS FILE IS

SUPPOSED TO BE USED FOR THE UNIQUE DROPDOWN MENUES

''' if name == "main":

print('Quota Calculator\n')

name = co_name           #input("Customer/Company Name: ")
size = comp_size      #int(input("Size of Company: ")) 
#while size <1 or size >200:     #need to check that is between 1-200
    #print("\nError! Company size must be between 1-200! Please enter a valid input...")            Has to be tunred into a GUI output
    #size = int(input("Size of Company: "))

option1 = option_1      #input("Service 1: ") #required
#while option1 not in service:
    #print("\nError! Please enter a valid service...")
    #option1 = input("Service 1: ") #required

option2 = option_2      #input("Service 2: ") #optional
#while option2 not in service:
    #print("\nError! Please enter a valid service...")
    #option2 = input("Service 2: ") #required

option3 = option_3      #input("Service 3: ") #optional
#while option3 not in service:
    #print("\nError! Please enter a valid service...")
    #option3 = input("Service 3: ") #required
#print("\nPrinting the results...\n")
# print(name)
# print(size)
# print(option1)
# print(option2)
# print(option3)
'''

''' calc = QuotaCalc(name, size, option1, option2, option3) timeRequired = calc.getTime() time_required = tkinter.Label(window, text = timeRequired, font=('Arial Narrow', 20)).grid(row=175, column=85) #print("Time rquired: ", str(timeRequired) + " month(s)")

totalCost = calc.calcCost()
totalCost = format(totalCost, '.2f')
total_costs = tkinter.Label(window, text = 'Price Quote', font=('Arial Narrow', 20)).grid(row=200, column=85)    #print("Price quote: $", totalCost)

''' window.mainloop() #Tells the program to continue running until the GUI is closed

baumbachb commented 3 years ago

This is the near complete code, just trying to get the button to do the calculations at this point

'''

Barrington Advisory Solutions BIS Development Team Project

'''

import tkinter

service = { #This is the dictionary that holds all of the services and their associated prices 'Mergers and Acquisitions':3000, 'Business Valuations':2000, 'Financial Analysis & Operational Ideas':5000, 'Strategic Planning Services':3500, 'Specialized Strategic Consultion Services':4000, 'Litigation Support':6000, '': 0 }

services = [ #This is the list that holds all of the services (Used for the GUI output) '', 'Mergers and Acquisitions', 'Business Valuations', 'Financial Analysis & Operational Ideas', 'Strategic Planning Services', 'Specialized Strategic Consultion Services', '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):      ##This initializes the class with all of the variables that we will use

    self.cust_name = cust_name

    main.title('Barrington Advisory Quota Calculator')        #Window Title
    main.geometry('400x325')         #Sets the size of the window
    #window.configure(bg='light blue') <- If we want to change the color of the background

    self.co_name = tkinter.Label(main, text = 'Customer/Company Name', font=('Arial Narrow', 20)).grid(row=40, column=10)        #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 = 40, column=85)      #Allows user to input information       #by putting both on row 0, it alligns the text

    clicked = tkinter.StringVar()           #initalizing "clicked" as a string variable
    clicked2 = tkinter.StringVar()
    clicked3 = tkinter.StringVar()

    clicked.set(services[0])                #Text to be displayed on the menu dropdown
    clicked2.set(services[0])
    clicked3.set(services[0])

    self.comp_size = tkinter.Label(main, text = 'Company Size', font=('Arial Narrow', 20)).grid(row=60, column=10)
    self.comp_size_input = tkinter.Entry(main).grid(row = 60, column=85) 

    self.option_1 = tkinter.Label(main, text = 'Service 1 Needed', font=('Arial Narrow', 20)).grid(row=80, column=10)     
    self.drop = tkinter.OptionMenu( main , clicked , *service ).grid(row = 80, column=85)               #refers to the set number of services for dropdown

    self.option_2 = tkinter.Label(main, text = 'Service 2 Needed', font=('Arial Narrow', 20)).grid(row=100, column=10)
    self.drop2 = tkinter.OptionMenu( main , clicked2 , *service ).grid(row = 100, column=85)

    self.option_3 = tkinter.Label(main, text = 'Service 3 Needed', font=('Arial Narrow', 20)).grid(row=120, column=10)
    self.drop3 = tkinter.OptionMenu( main , clicked3 , *service ).grid(row = 120, column=85)

    bt = tkinter.Button(main, text='Calculate', command = myClick, fg = "purple", bg = "light blue").grid(row=150, column = 25)     ##fg is foreground (color), bg is background (color)
    #Need to convert to when the button presses, it runs other functions of the class

    #self.co_size = co_size
    #self.option1 = option1
    #self.option2 = option2
    #self.option3 = option3
    #self.timeRequired = 0

    if co_size == 0:                        #This determines how much time will be necessary based on the size of the company
        self.timeRequired = 0
    elif co_size <= 20:
        self.timeRequired = 1
    elif co_size <= 40:
        self.timeRequired = 2
    elif co_size <= 60:
        self.timeRequired = 3
    elif co_size <= 80:
        self.timeRequired = 4
    elif co_size <= 100:
        self.timeRequired = 5
    elif co_size <= 150:
        self.timeRequired = 6
    else:
        self.timeRequired = 8

    time_req = tkinter.Label(window, text = 'Time Required', font=('Arial Narrow', 20)).grid(row=175, column=10)

    total_cost = tkinter.Label(window, text = 'Price Quote', font=('Arial Narrow', 20)).grid(row=200, column=10)    

def myClick(self):
    myLabel = tkinter.Label(main, text = getTime)

def getTime(self):
    return self.timeRequired

def calcCost(self):                                 #This calculates the total cost of the services
    cost = self.timeRequired * service[self.option1]
    if self.option2:
        cost += self.timeRequired * service[self.option2]
    if self.option3:
        cost += self.timeRequired * service[self.option3]

    return cost

''' window.title('Barrington Advisory Quota Calculator') #Window Title window.geometry('400x325') #Sets the size of the window

window.configure(bg='light blue') <- If we want to change the color of the background

if name == "main":

print('Quota Calculator\n')

#name = co_name           #input("Customer/Company Name: ")
#size = comp_size      #int(input("Size of Company: ")) 
#while size <1 or size >200:     #need to check that is between 1-200
    #print("\nError! Company size must be between 1-200! Please enter a valid input...")            Has to be tunred into a GUI output
    #size = int(input("Size of Company: "))

#option1 = option_1      #input("Service 1: ") #required
#while option1 not in service:
    #print("\nError! Please enter a valid service...")
    #option1 = input("Service 1: ") #required

#option2 = option_2      #input("Service 2: ") #optional
#while option2 not in service:
    #print("\nError! Please enter a valid service...")
    #option2 = input("Service 2: ") #required

#option3 = option_3      #input("Service 3: ") #optional
#while option3 not in service:
    #print("\nError! Please enter a valid service...")
    #option3 = input("Service 3: ") #required
#print("\nPrinting the results...\n")
# print(name)
# print(size)
# print(option1)
# print(option2)
# print(option3)

#calc = QuotaCalc(name, size, option1, option2, option3)
#timeRequired = calc.getTime()
#time_required = tkinter.Label(window, text = timeRequired, font=('Arial Narrow', 20)).grid(row=175, column=85)       #print("Time rquired: ", str(timeRequired) + " month(s)")

#totalCost = calc.calcCost()
#totalCost = format(totalCost, '.2f')
#total_costs = tkinter.Label(window, text = 'Price Quote', font=('Arial Narrow', 20)).grid(row=200, column=85)    #print("Price quote: $", totalCost)

''' e = QuotaCalc(window)

window.mainloop() #Tells the program to continue running until the GUI is closed

baumbachb commented 3 years ago

'''

Barrington Advisory Solutions BIS Development Team Project

'''

import tkinter

service = { #This is the dictionary that holds all of the services and their associated prices 'Mergers and Acquisitions':3000, 'Business Valuations':2000, 'Financial Analysis & Operational Ideas':5000, 'Strategic Planning Services':3500, 'Specialized Strategic Consultion Services':4000, 'Litigation Support':6000, '': 0 }

services = [ #This is the list that holds all of the services (Used for the GUI output) '', 'Mergers and Acquisitions', 'Business Valuations', 'Financial Analysis & Operational Ideas', 'Strategic Planning Services', 'Specialized Strategic Consultion Services', '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):      ##This initializes the class with all of the variables that we will use

    self.cust_name = cust_name

    main.title('Barrington Advisory Quota Calculator')        #Window Title
    main.geometry('400x325')         #Sets the size of the window
    #window.configure(bg='light blue') <- If we want to change the color of the background

    self.co_name = tkinter.Label(main, text = 'Customer/Company Name', font=('Arial Narrow', 20)).grid(row=40, column=10)        #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 = 40, column=85)      #Allows user to input information       #by putting both on row 0, it alligns the text

    clicked = tkinter.StringVar()           #initalizing "clicked" as a string variable
    clicked2 = tkinter.StringVar()
    clicked3 = tkinter.StringVar()

    clicked.set(services[0])                #Text to be displayed on the menu dropdown
    clicked2.set(services[0])
    clicked3.set(services[0])

    self.comp_size = tkinter.Label(main, text = 'Company Size', font=('Arial Narrow', 20)).grid(row=60, column=10)
    self.comp_size_input = tkinter.Entry(main).grid(row = 60, column=85) 

    self.option_1 = tkinter.Label(main, text = 'Service 1 Needed', font=('Arial Narrow', 20)).grid(row=80, column=10)     
    self.drop = tkinter.OptionMenu( main , clicked , *service ).grid(row = 80, column=85)               #refers to the set number of services for dropdown

    self.option_2 = tkinter.Label(main, text = 'Service 2 Needed', font=('Arial Narrow', 20)).grid(row=100, column=10)
    self.drop2 = tkinter.OptionMenu( main , clicked2 , *service ).grid(row = 100, column=85)

    self.option_3 = tkinter.Label(main, text = 'Service 3 Needed', font=('Arial Narrow', 20)).grid(row=120, column=10)
    self.drop3 = tkinter.OptionMenu( main , clicked3 , *service ).grid(row = 120, column=85)

    bt = tkinter.Button(main, text='Calculate', command = self.myClick(), fg = "purple", bg = "light blue").grid(row=150, column = 25)     ##fg is foreground (color), bg is background (color)
    #Need to convert to when the button presses, it runs other functions of the class

    #self.co_size = co_size
    #self.option1 = option1
    #self.option2 = option2
    #self.option3 = option3
    #self.timeRequired = 0

    if co_size == 0:                        #This determines how much time will be necessary based on the size of the company
        self.timeRequired = 0
    elif co_size <= 20:
        self.timeRequired = 1
    elif co_size <= 40:
        self.timeRequired = 2
    elif co_size <= 60:
        self.timeRequired = 3
    elif co_size <= 80:
        self.timeRequired = 4
    elif co_size <= 100:
        self.timeRequired = 5
    elif co_size <= 150:
        self.timeRequired = 6
    else:
        self.timeRequired = 8

    time_req = tkinter.Label(window, text = 'Time Required', font=('Arial Narrow', 20)).grid(row=175, column=10)

    total_cost = tkinter.Label(window, text = 'Price Quote', font=('Arial Narrow', 20)).grid(row=200, column=10)    

def myClick(self):
    myLabel = tkinter.Label(window, text = self.getTime).grid(row=175, column=85)
    myLabel2 = tkinter.Label(window, text = self.calcCost).grid(row=200, column=85)

def getTime(self):
    return self.timeRequired

def calcCost(self):                                 #This calculates the total cost of the services
    cost = self.timeRequired * service[self.option1]
    if self.option2:
        cost += self.timeRequired * service[self.option2]
    if self.option3:
        cost += self.timeRequired * service[self.option3]

    return cost

''' if name == "main":

print('Quota Calculator\n')

#name = co_name           #input("Customer/Company Name: ")
#size = comp_size      #int(input("Size of Company: ")) 
#while size <1 or size >200:     #need to check that is between 1-200
    #print("\nError! Company size must be between 1-200! Please enter a valid input...")            Has to be tunred into a GUI output
    #size = int(input("Size of Company: "))

#option1 = option_1      #input("Service 1: ") #required
#while option1 not in service:
    #print("\nError! Please enter a valid service...")
    #option1 = input("Service 1: ") #required

#option2 = option_2      #input("Service 2: ") #optional
#while option2 not in service:
    #print("\nError! Please enter a valid service...")
    #option2 = input("Service 2: ") #required

#option3 = option_3      #input("Service 3: ") #optional
#while option3 not in service:
    #print("\nError! Please enter a valid service...")
    #option3 = input("Service 3: ") #required
#print("\nPrinting the results...\n")
# print(name)
# print(size)
# print(option1)
# print(option2)
# print(option3)

#calc = QuotaCalc(name, size, option1, option2, option3)
#timeRequired = calc.getTime()
#time_required = tkinter.Label(window, text = timeRequired, font=('Arial Narrow', 20)).grid(row=175, column=85)       #print("Time rquired: ", str(timeRequired) + " month(s)")

#totalCost = calc.calcCost()
#totalCost = format(totalCost, '.2f')
#total_costs = tkinter.Label(window, text = 'Price Quote', font=('Arial Narrow', 20)).grid(row=200, column=85)    #print("Price quote: $", totalCost)

''' e = QuotaCalc(window)

window.mainloop() #Tells the program to continue running until the GUI is closed