-
-
Save cjboyd1999/8475225d0cc6a2d2d1c62697e14f6d10 to your computer and use it in GitHub Desktop.
Crisis Budget - Hack The Crisis
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This gist contains the files necessary to run the Crisis Budget desktop prototype app, | |
created for the 'Hack The Crisis (Australia)' hackathon. | |
Ensure that the tkinter/ttk libraries are installed if you wish to run the program. | |
Running main.py will launch the program. | |
A demonstration of the program can be found here: https://www.youtube.com/watch?v=HW6o-973yNU&feature=youtu.be | |
The information used to determine financial aid amount was gathered from the following sources: | |
[1] https://treasury.gov.au/sites/default/files/2020-03/Fact_sheet-Income_Support_for_Individuals_0.pdf | |
[2] https://www.theguardian.com/world/2020/mar/26/us-coronavirus-stimulus-all-you-need-to-know | |
[3] https://www.bbc.com/news/business-51628524 | |
[4] https://treasury.gov.au/sites/default/files/2020-04/fact_sheet-boosting_cash_flow_for_employers.pdf | |
[5] https://nymag.com/intelligencer/2020/04/how-to-get-a-small-business-loan-from-the-coronavirus-stimulus-bill.html | |
This program was developed by Cameron Boyd for Hack The Crisis - Crisis Budget |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tkinter | |
import PIL.Image | |
import PIL.ImageTk | |
from tkinter import * | |
from tkinter.font import Font | |
from tkinter.ttk import * | |
def AusBusiness(window, canvas): | |
soleil = Font(family="Soleil", size=26) | |
lato = Font(family="Lato", size=18) | |
style = Style() | |
style.configure("Next.TButton", background='#6558F5', foreground='#020202', font=lato) | |
style.configure("Exit.TButton", background='#D3455B', foreground='#020202', font=lato) | |
style.configure("Main.TCheckbutton", font=lato, foreground='#020202', background='#EDEDF3') | |
def AusBusExitButton(): | |
window.destroy() | |
def AusBusNextButton(): | |
canvas.delete("all") | |
chk1.place(x=-1000, y=-1000) | |
chk2.place(x=-1000, y=-1000) | |
chk3.place(x=-1000, y=-1000) | |
chk4.place(x=-1000, y=-1000) | |
chk5.place(x=-1000, y=-1000) | |
nextBtn.place(x=-1000, y=-1000) | |
x = varTrue() | |
if x == True: | |
canvas.create_text(640, 100, text="Your business is eligible for a tax-free A$20,000 - A$100,000\ncash boost upon lodgement of an activity statement.\n(Payments will not be made prior to 28 April 2020 but can be lodged).", justify=CENTER, fill='#020202', font=soleil) | |
elif x == False: | |
canvas.create_text(640, 100, text="Your business is ineligible for any COVID-19 financial aid.", justify=CENTER, fill='#020202', font=soleil) | |
canvas.create_text(388, 660, text="Progress: 100%", justify=LEFT, fill='#020202', font=lato) | |
canvas.create_rectangle(320, 680, 960, 695, fill='#90929C', outline='#90929C') | |
canvas.create_rectangle(320, 680, 960, 695, fill='#6558F5', outline='#6558F5') | |
exitBtn.place(x=560, y=575) | |
def varTrue(): | |
if var1.get() == 1 and var2.get() == 1 and var3.get() == 1 and var4.get() == 1 and var5.get() == 1: | |
return True | |
else: | |
return False | |
canvas.create_text(640, 100, text="An Australian business? Awesome.\nPlease tick any of the boxes that you meet the criteria for.", justify=CENTER, fill='#020202', font=soleil) | |
var1 = IntVar() | |
chk1 = Checkbutton(canvas, text='Currently holding an ABN that was active from at latest 12 March 2020.', variable=var1, style='Main.TCheckbutton') | |
chk1.place(x=250, y=200) | |
var2 = IntVar() | |
chk2 = Checkbutton(canvas, text='Small or medium business.', variable=var2, style='Main.TCheckbutton') | |
chk2.place(x=250, y=250) | |
var3 = IntVar() | |
chk3 = Checkbutton(canvas, text='Annual turnover is less than A$50 million.', variable=var3, style='Main.TCheckbutton') | |
chk3.place(x=250, y=300) | |
var4 = IntVar() | |
chk4 = Checkbutton(canvas, text='Made eligible payments that the business is required to withhold.', variable=var4, style='Main.TCheckbutton') | |
chk4.place(x=250, y=350) | |
var5 = IntVar() | |
chk5 = Checkbutton(canvas, text='Lodged 2019 tax return before 12 March 2020 OR:\nMade GST taxable, GST-free or input-taxed sales in a previous tax period.', variable=var5, style='Main.TCheckbutton') | |
chk5.place(x=250, y=400) | |
nextBtn = Button(canvas, text='FINISH', style='Next.TButton', command=AusBusNextButton) | |
nextBtn.place(x=715, y=575); | |
exitBtn = Button(canvas, text='EXIT', style='Exit.TButton', command=AusBusExitButton) | |
exitBtn.place(x=400, y=575); | |
canvas.create_text(388, 660, text="Progress: 40%", justify=LEFT, fill='#020202', font=lato) | |
canvas.create_rectangle(320, 680, 960, 695, fill='#90929C', outline='#90929C') | |
canvas.create_rectangle(320, 680, 576, 695, fill='#6558F5', outline='#6558F5') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tkinter | |
import PIL.Image | |
import PIL.ImageTk | |
from tkinter import * | |
from tkinter.font import Font | |
from tkinter.ttk import * | |
def AusIndividual(window, canvas): | |
soleil = Font(family="Soleil", size=26) | |
lato = Font(family="Lato", size=18) | |
style = Style() | |
style.configure("Next.TButton", background='#6558F5', foreground='#020202', font=lato) | |
style.configure("Exit.TButton", background='#D3455B', foreground='#020202', font=lato) | |
style.configure("Main.TCheckbutton", font=lato, foreground='#020202', background='#EDEDF3') | |
def AusIndExitButton(): | |
window.destroy() | |
def AusIndNextButton(): | |
canvas.delete("all") | |
chk1.place(x=-1000, y=-1000) | |
chk2.place(x=-1000, y=-1000) | |
chk3.place(x=-1000, y=-1000) | |
chk4.place(x=-1000, y=-1000) | |
chk5.place(x=-1000, y=-1000) | |
chk6.place(x=-1000, y=-1000) | |
chk7.place(x=-1000, y=-1000) | |
nextBtn.place(x=-1000, y=-1000) | |
x = varTrue() | |
if x == True: | |
canvas.create_text(640, 100, text="You are eligible for A$275 per week\n(paid $550/fortnight for the next 6 months).", justify=CENTER, fill='#020202', font=soleil) | |
elif x == False: | |
canvas.create_text(640, 100, text="You are ineligible for any COVID-19 financial aid.", justify=CENTER, fill='#020202', font=soleil) | |
canvas.create_text(388, 660, text="Progress: 100%", justify=LEFT, fill='#020202', font=lato) | |
canvas.create_rectangle(320, 680, 960, 695, fill='#90929C', outline='#90929C') | |
canvas.create_rectangle(320, 680, 960, 695, fill='#6558F5', outline='#6558F5') | |
exitBtn.place(x=560, y=575) | |
def varTrue(): | |
if var1.get() == 1: | |
return True | |
elif var2.get() == 1: | |
return True | |
elif var3.get() == 1: | |
return True | |
elif var4.get() == 1: | |
return True | |
elif var5.get() == 1: | |
return True | |
elif var6.get() == 1: | |
return True | |
elif var7.get() == 1: | |
return True | |
else: | |
return False | |
canvas.create_text(640, 100, text="An Australian individual? Awesome.\nPlease tick any of the boxes if you are receiving any of\ntheir corresponding packages.", justify=CENTER, fill='#020202', font=soleil) | |
var1 = IntVar() | |
chk1 = Checkbutton(canvas, text='Jobseeker Payment', variable=var1, style='Main.TCheckbutton') | |
chk1.place(x=520, y=200) | |
var2 = IntVar() | |
chk2 = Checkbutton(canvas, text='Youth Allowance', variable=var2, style='Main.TCheckbutton') | |
chk2.place(x=520, y=250) | |
var3 = IntVar() | |
chk3 = Checkbutton(canvas, text='Parent Payment', variable=var3, style='Main.TCheckbutton') | |
chk3.place(x=520, y=300) | |
var4 = IntVar() | |
chk4 = Checkbutton(canvas, text='Austudy', variable=var4, style='Main.TCheckbutton') | |
chk4.place(x=520, y=350) | |
var5 = IntVar() | |
chk5 = Checkbutton(canvas, text='ABSTUDY', variable=var5, style='Main.TCheckbutton') | |
chk5.place(x=520, y=400) | |
var6 = IntVar() | |
chk6 = Checkbutton(canvas, text='Farm Household Allowance', variable=var6, style='Main.TCheckbutton') | |
chk6.place(x=520, y=450) | |
var7 = IntVar() | |
chk7 = Checkbutton(canvas, text='Special Benefits', variable=var7, style='Main.TCheckbutton') | |
chk7.place(x=520, y=500) | |
nextBtn = Button(canvas, text='FINISH', style='Next.TButton', command=AusIndNextButton) | |
nextBtn.place(x=715, y=575); | |
exitBtn = Button(canvas, text='EXIT', style='Exit.TButton', command=AusIndExitButton) | |
exitBtn.place(x=400, y=575); | |
canvas.create_text(388, 660, text="Progress: 40%", justify=LEFT, fill='#020202', font=lato) | |
canvas.create_rectangle(320, 680, 960, 695, fill='#90929C', outline='#90929C') | |
canvas.create_rectangle(320, 680, 576, 695, fill='#6558F5', outline='#6558F5') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tkWindowSetup import * | |
from q1 import * | |
window = setupWindow() | |
q1_canvas = Canvas(window, bg='#EDEDF3', width=1280, height=720) | |
q1_canvas.pack() | |
world_map = PIL.ImageTk.PhotoImage(PIL.Image.open('blank map.png')) | |
q1_canvas.create_image(640, 300, image=world_map) | |
RunQ1(window, q1_canvas) | |
window.mainloop() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from q2 import * | |
def RunQ1(window, canvas): | |
soleil = Font(family="Soleil", size=26) | |
lato = Font(family="Lato", size=18) | |
style = Style() | |
style.configure("Next.TButton", background='#6558F5', foreground='#020202', font=lato) | |
style.configure("Exit.TButton", background='#D3455B', foreground='#020202', font=lato) | |
aus_map = PIL.ImageTk.PhotoImage(PIL.Image.open('aus map.png')) | |
uk_map = PIL.ImageTk.PhotoImage(PIL.Image.open('uk map.png')) | |
us_map = PIL.ImageTk.PhotoImage(PIL.Image.open('us map.png')) | |
def ChangeMap(event): | |
if combox.current() == 0: | |
canvas.create_image(640, 300, image=aus_map) | |
nextBtn.configure(state='normal') | |
elif combox.current() == 1: | |
canvas.create_image(640, 300, image=uk_map) | |
nextBtn.configure(state='normal') | |
elif combox.current() == 2: | |
canvas.create_image(640, 300, image=us_map) | |
nextBtn.configure(state='normal') | |
canvas.create_text(640, 100, text="Hello, welcome to the Crisis Budget planner.\nGet started by selecting the country you are residing in.", justify=CENTER, fill='#020202', font=soleil) | |
choices = ['Australia', 'United Kingdom', 'United States of America'] | |
variable = StringVar(window) | |
variable.set('Australia') | |
window.option_add("*TCombobox*Listbox*Font", lato) | |
combox = Combobox(window, values=choices, font=lato, width=20, state='readonly') | |
combox.place(x=490, y=450) | |
combox.bind("<<ComboboxSelected>>", ChangeMap) | |
def Q1ExitButton(): | |
window.destroy() | |
def Q1NextButton(): | |
canvas.delete("all") | |
combox.place(x=-1000, y=-1000) | |
nextBtn.place(x=-1000, y=-1000) | |
exitBtn.place(x=-1000, y=-1000) | |
selectedCountry = combox.current() | |
RunQ2(window, canvas, selectedCountry) | |
nextBtn = Button(canvas, text='NEXT', style='Next.TButton', command=Q1NextButton) | |
nextBtn.configure(state='disabled') | |
nextBtn.place(x=715, y=575); | |
exitBtn = Button(canvas, text='EXIT', style='Exit.TButton', command=Q1ExitButton) | |
exitBtn.place(x=400, y=575); | |
canvas.create_text(388, 660, text="Progress: 0%", justify=LEFT, fill='#020202', font=lato) | |
canvas.create_rectangle(320, 680, 960, 695, fill='#90929C', outline='#90929C') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from q3 import * | |
def RunQ2(window, canvas, country): | |
soleil = Font(family="Soleil", size=26) | |
lato = Font(family="Lato", size=18) | |
style = Style() | |
style.configure("Next.TButton", background='#6558F5', foreground='#020202', font=lato) | |
style.configure("Exit.TButton", background='#D3455B', foreground='#020202', font=lato) | |
style.configure("Choice.TRadiobutton", font=lato, foreground='#020202', background='#EDEDF3') | |
if country == 0: | |
c = 'Australian' | |
elif country == 1: | |
c = 'British' | |
elif country == 2: | |
c = 'American' | |
canvas.create_text(640, 100, text="Okay great! So you're " + c + ", cool!\nNow, are you a small business, or an individual?", justify=CENTER, fill='#020202', font=soleil) | |
options = ['Small Business', 'Individual'] | |
v = IntVar(value=-1) | |
def activateButton(): | |
nextBtn.configure(state='normal') | |
r1 = Radiobutton(canvas, text=options[0], variable=v, value=0, style='Choice.TRadiobutton', command=activateButton) | |
r1.place(x=400, y=450) | |
r2 = Radiobutton(canvas, text=options[1], variable=v, value=1, style='Choice.TRadiobutton', command=activateButton) | |
r2.place(x=700, y=450) | |
def Q2ExitButton(): | |
window.destroy() | |
def Q2NextButton(): | |
canvas.delete("all") | |
selectedType = v.get() | |
r1.place(x=-1000, y=-1000) | |
r2.place(x=-1000, y=-1000) | |
nextBtn.place(x=-1000, y=-1000) | |
exitBtn.place(x=-1000, y=-1000) | |
RunQ3(window, canvas, country, selectedType) | |
nextBtn = Button(canvas, text='NEXT', style='Next.TButton', command=Q2NextButton) | |
nextBtn.configure(state='disabled') | |
nextBtn.place(x=715, y=575); | |
exitBtn = Button(canvas, text='EXIT', style='Exit.TButton', command=Q2ExitButton) | |
exitBtn.place(x=400, y=575); | |
canvas.create_text(388, 660, text="Progress: 10%", justify=LEFT, fill='#020202', font=lato) | |
canvas.create_rectangle(320, 680, 960, 695, fill='#90929C', outline='#90929C') | |
canvas.create_rectangle(320, 680, 384, 695, fill='#6558F5', outline='#6558F5') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from ausIndividual import * | |
from ausBusiness import * | |
from ukIndividual import * | |
from ukBusiness import * | |
from usIndividual import * | |
from usBusiness import * | |
def RunQ3(window, canvas, country, personType): | |
soleil = Font(family="Soleil", size=26) | |
lato = Font(family="Lato", size=18) | |
style = Style() | |
style.configure("Next.TButton", background='#6558F5', foreground='#020202', font=lato) | |
style.configure("Exit.TButton", background='#D3455B', foreground='#020202', font=lato) | |
if country == 0: | |
if personType == 0: | |
AusBusiness(window, canvas) | |
elif personType == 1: | |
AusIndividual(window, canvas) | |
elif country == 1: | |
if personType == 0: | |
UkBusiness(window, canvas) | |
elif personType == 1: | |
UkIndividual(window, canvas) | |
elif country == 2: | |
if personType == 0: | |
UsBusiness(window, canvas) | |
elif personType == 1: | |
UsIndividual(window, canvas) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tkinter | |
from tkinter import * | |
from tkinter.ttk import * | |
def setupWindow(): | |
window = Tk() | |
window.title("Crisis Budget Planner") | |
window.configure(bg="#EDEDF3") | |
screen_width = window.winfo_screenwidth() | |
screen_height = window.winfo_screenheight() | |
distX = (screen_width - 1280) / 2 | |
distY = (screen_height - 720) / 2 | |
window.geometry("1280x720+{}+{}".format(int(distX), int(distY))) | |
window.maxsize(1280,720) | |
window.minsize(1280,720) | |
return window |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tkinter | |
import PIL.Image | |
import PIL.ImageTk | |
from tkinter import * | |
from tkinter.font import Font | |
from tkinter.ttk import * | |
def UkBusiness(window, canvas): | |
soleil = Font(family="Soleil", size=26) | |
lato = Font(family="Lato", size=18) | |
style = Style() | |
style.configure("Next.TButton", background='#6558F5', foreground='#020202', font=lato) | |
style.configure("Exit.TButton", background='#D3455B', foreground='#020202', font=lato) | |
style.configure("Main.TCheckbutton", font=lato, foreground='#020202', background='#EDEDF3') | |
def UkBusExitButton(): | |
window.destroy() | |
canvas.create_text(640, 100, text="Sorry, we are unable to calculate a financial aid\nestimation for British businesses at this time.", justify=CENTER, fill='#020202', font=soleil) | |
exitBtn = Button(canvas, text='EXIT', style='Exit.TButton', command=UkBusExitButton) | |
exitBtn.place(x=560, y=575); | |
canvas.create_text(388, 660, text="Progress: 100%", justify=LEFT, fill='#020202', font=lato) | |
canvas.create_rectangle(320, 680, 960, 695, fill='#90929C', outline='#90929C') | |
canvas.create_rectangle(320, 680, 960, 695, fill='#6558F5', outline='#6558F5') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tkinter | |
import PIL.Image | |
import PIL.ImageTk | |
from tkinter import * | |
from tkinter.font import Font | |
from tkinter.ttk import * | |
def UkIndividual(window, canvas): | |
soleil = Font(family="Soleil", size=26) | |
lato = Font(family="Lato", size=18) | |
style = Style() | |
style.configure("Next.TButton", background='#6558F5', foreground='#020202', font=lato) | |
style.configure("Exit.TButton", background='#D3455B', foreground='#020202', font=lato) | |
style.configure("Main.TCheckbutton", font=lato, foreground='#020202', background='#EDEDF3') | |
def UkIndExitButton(): | |
window.destroy() | |
def UkIndNextButton(): | |
canvas.delete("all") | |
chk1.place(x=-1000, y=-1000) | |
chk2.place(x=-1000, y=-1000) | |
chk3.place(x=-1000, y=-1000) | |
nextBtn.place(x=-1000, y=-1000) | |
x = varTrue() | |
if x == 1: | |
canvas.create_text(640, 100, text="You are eligible for 80% of your salary\nup to a maximum of £625 per week.\n(Paid as a lump sum payment every 3 months).", justify=CENTER, fill='#020202', font=soleil) | |
elif x == 2: | |
canvas.create_text(640, 100, text="You are eligible for 80% of your average\nmonthly profits for the last three years up to a maximum of £625 per week.\n(Paid as a lump sum payment every 3 months).", justify=CENTER, fill='#020202', font=soleil) | |
elif x == 3: | |
canvas.create_text(640, 100, text="You are ineligible for any COVID-19 financial aid.", justify=CENTER, fill='#020202', font=soleil) | |
canvas.create_text(388, 660, text="Progress: 100%", justify=LEFT, fill='#020202', font=lato) | |
canvas.create_rectangle(320, 680, 960, 695, fill='#90929C', outline='#90929C') | |
canvas.create_rectangle(320, 680, 960, 695, fill='#6558F5', outline='#6558F5') | |
exitBtn.place(x=560, y=575) | |
def varTrue(): | |
if var1.get() == 1 and var2.get() == 0 and var3.get() == 1: | |
return 1 | |
elif var1.get() == 0 and var2.get() == 1 and var3.get() == 1: | |
return 2 | |
elif var1.get() == 1 and var2.get() == 1 and var3.get() == 1: | |
return 2 | |
else: | |
return 3 | |
canvas.create_text(640, 100, text="A British individual? Awesome.\nPlease check any boxes that are relevant to you.", justify=CENTER, fill='#020202', font=soleil) | |
var1 = IntVar() | |
chk1 = Checkbutton(canvas, text='Work in the private sector full-time or part-time.', variable=var1, style='Main.TCheckbutton') | |
chk1.place(x=350, y=200) | |
var2 = IntVar() | |
chk2 = Checkbutton(canvas, text='Self-employed and had a loss of income.', variable=var2, style='Main.TCheckbutton') | |
chk2.place(x=350, y=250) | |
var3 = IntVar() | |
chk3 = Checkbutton(canvas, text='Pay tax through the Pay-As-You-Earn (PAYE) system.', variable=var3, style='Main.TCheckbutton') | |
chk3.place(x=350, y=300) | |
nextBtn = Button(canvas, text='FINISH', style='Next.TButton', command=UkIndNextButton) | |
nextBtn.place(x=715, y=575); | |
exitBtn = Button(canvas, text='EXIT', style='Exit.TButton', command=UkIndExitButton) | |
exitBtn.place(x=400, y=575); | |
canvas.create_text(388, 660, text="Progress: 40%", justify=LEFT, fill='#020202', font=lato) | |
canvas.create_rectangle(320, 680, 960, 695, fill='#90929C', outline='#90929C') | |
canvas.create_rectangle(320, 680, 576, 695, fill='#6558F5', outline='#6558F5') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tkinter | |
import PIL.Image | |
import PIL.ImageTk | |
from tkinter import * | |
from tkinter.font import Font | |
from tkinter.ttk import * | |
def UsBusiness(window, canvas): | |
soleil = Font(family="Soleil", size=26) | |
lato = Font(family="Lato", size=18) | |
style = Style() | |
style.configure("Next.TButton", background='#6558F5', foreground='#020202', font=lato) | |
style.configure("Exit.TButton", background='#D3455B', foreground='#020202', font=lato) | |
style.configure("Main.TCheckbutton", font=lato, foreground='#020202', background='#EDEDF3') | |
def UsBusExitButton(): | |
window.destroy() | |
def UsBusNextButton(): | |
canvas.delete("all") | |
chk1.place(x=-1000, y=-1000) | |
chk2.place(x=-1000, y=-1000) | |
chk3.place(x=-1000, y=-1000) | |
nextBtn.place(x=-1000, y=-1000) | |
amountLabel.place(x=-1000, y=-1000) | |
amountEntry.place(x=-1000, y=-1000) | |
isValid() | |
canvas.create_text(388, 660, text="Progress: 100%", justify=LEFT, fill='#020202', font=lato) | |
canvas.create_rectangle(320, 680, 960, 695, fill='#90929C', outline='#90929C') | |
canvas.create_rectangle(320, 680, 960, 695, fill='#6558F5', outline='#6558F5') | |
exitBtn.place(x=560, y=575) | |
def showEarningsInput(): | |
amountLabel.place(x=150, y=350) | |
amountEntry.place(x=550, y=350) | |
def generatePay(pay): | |
p = pay + (pay * 0.25) | |
if p > 10000000: | |
return 10000000 | |
else: | |
return p | |
def isValid(): | |
if var1.get() == 1: | |
payout = generatePay(int(amountString.get())) | |
if var2.get() == 1: | |
payout = generatePay(int(amountString.get())) | |
if var3.get() == 1: | |
payout = generatePay(int(amountString.get())) | |
elif var1.get() == 0 and var2.get() == 0 and var3.get() == 0: | |
payout = 0 | |
if payout > 0: | |
canvas.create_text(640, 100, text="Your business is eligible for a loan of US${:0,.2f}.".format(payout), justify=CENTER, fill='#020202', font=soleil) | |
canvas.create_text(640, 360, text='No payments have to be made on this loan for 6 months.\nIf you maintain your workforce, the government will\nmore or less forive the loan', justify=CENTER, fill='#020202', font=lato) | |
else: | |
canvas.create_text(640, 100, text="Your business is ineligible for any COVID-19 financial aid.", justify=CENTER, fill='#020202', font=soleil) | |
canvas.create_text(640, 100, text="An American business? Awesome.\nPlease tick any of the boxes that you meet the criteria for.", justify=CENTER, fill='#020202', font=soleil) | |
var1 = IntVar() | |
chk1 = Checkbutton(canvas, text='A company, non-profit, veterans org. or tribal concern with 500 or less employees.', variable=var1, style='Main.TCheckbutton', command=showEarningsInput) | |
chk1.place(x=150, y=200) | |
var2 = IntVar() | |
chk2 = Checkbutton(canvas, text='Self-employed.', variable=var2, style='Main.TCheckbutton', command=showEarningsInput) | |
chk2.place(x=150, y=250) | |
var3 = IntVar() | |
chk3 = Checkbutton(canvas, text='Independent contractor.', variable=var3, style='Main.TCheckbutton', command=showEarningsInput) | |
chk3.place(x=150, y=300) | |
amountLabel = Label(canvas, text=" Past 8 weeks average prior payroll: ", font=lato, background='#EDEDF3') | |
amountString = StringVar() | |
amountEntry = Entry(canvas, width=15, font=lato, textvariable=amountString) | |
nextBtn = Button(canvas, text='FINISH', style='Next.TButton', command=UsBusNextButton) | |
nextBtn.place(x=715, y=575); | |
exitBtn = Button(canvas, text='EXIT', style='Exit.TButton', command=UsBusExitButton) | |
exitBtn.place(x=400, y=575); | |
canvas.create_text(388, 660, text="Progress: 40%", justify=LEFT, fill='#020202', font=lato) | |
canvas.create_rectangle(320, 680, 960, 695, fill='#90929C', outline='#90929C') | |
canvas.create_rectangle(320, 680, 576, 695, fill='#6558F5', outline='#6558F5') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tkinter | |
import PIL.Image | |
import PIL.ImageTk | |
from tkinter import * | |
from tkinter.font import Font | |
from tkinter.ttk import * | |
def UsIndividual(window, canvas): | |
soleil = Font(family="Soleil", size=26) | |
lato = Font(family="Lato", size=18) | |
style = Style() | |
style.configure("Next.TButton", background='#6558F5', foreground='#020202', font=lato) | |
style.configure("Exit.TButton", background='#D3455B', foreground='#020202', font=lato) | |
style.configure("Main.TCheckbutton", font=lato, foreground='#020202', background='#EDEDF3') | |
def UsIndExitButton(): | |
window.destroy() | |
def UsIndNextButton(): | |
canvas.delete("all") | |
chk1.place(x=-1000, y=-1000) | |
chk2.place(x=-1000, y=-1000) | |
chk3.place(x=-1000, y=-1000) | |
chk4.place(x=-1000, y=-1000) | |
chk5.place(x=-1000, y=-1000) | |
nextBtn.place(x=-1000, y=-1000) | |
amountLabel.place(x=-1000, y=-1000) | |
childrenLabel.place(x=-1000, y=-1000) | |
amountEntry.place(x=-1000, y=-1000) | |
childrenEntry.place(x=-1000, y=-1000) | |
checkEligibility() | |
canvas.create_text(388, 660, text="Progress: 100%", justify=LEFT, fill='#020202', font=lato) | |
canvas.create_rectangle(320, 680, 960, 695, fill='#90929C', outline='#90929C') | |
canvas.create_rectangle(320, 680, 960, 695, fill='#6558F5', outline='#6558F5') | |
exitBtn.place(x=560, y=575) | |
def showEarningsInput(): | |
currentY = chk2.winfo_y() | |
chk2.place(x=300, y=currentY+50) | |
chk3.place(x=300, y=currentY+100) | |
chk4.place(x=300, y=currentY+150) | |
chk5.place(x=300, y=currentY+200) | |
amountLabel.place(x=300, y=currentY) | |
amountEntry.place(x=550, y=currentY) | |
def showChildrenInput(): | |
currentY = chk3.winfo_y() | |
chk3.place(x=300, y=currentY+50) | |
chk4.place(x=300, y=currentY+100) | |
chk5.place(x=300, y=currentY+150) | |
childrenLabel.place(x=300, y=currentY) | |
childrenEntry.place(x=550, y=currentY) | |
def getPayout(pay): | |
if pay <= 75000: | |
return 1200 | |
elif pay > 75000: | |
ret = (pay - 75000) / 100 | |
ret = 1200 - (ret * 5) | |
if ret < 0: | |
return 0 | |
else: | |
return ret | |
else: | |
window.destroy() | |
def checkEligibility(): | |
pay = 0 | |
if var1.get() == 1: | |
pay += getPayout(int(amountString.get())) | |
if var2.get() == 1: | |
pay += int(childrenString.get()) * 500 | |
if var5.get() == 1: | |
pay += 600 | |
if var4.get() == 1: | |
pay = 0 | |
if var3.get() == 0: | |
pay = 0 | |
if pay > 0: | |
canvas.create_text(640, 100, text="You are eligible for a payout of US${:0,.2f}.".format(pay), justify=CENTER, fill='#020202', font=soleil) | |
else: | |
canvas.create_text(640, 100, text="You are ineligible for any COVID-19 financial aid.", justify=CENTER, fill='#020202', font=soleil) | |
canvas.create_text(388, 660, text="Progress: 100%", justify=LEFT, fill='#020202', font=lato) | |
canvas.create_rectangle(320, 680, 960, 695, fill='#90929C', outline='#90929C') | |
canvas.create_rectangle(320, 680, 960, 695, fill='#6558F5', outline='#6558F5') | |
exitBtn.place(x=560, y=575) | |
canvas.create_text(640, 100, text="An American individual? Awesome.\nPlease check any boxes that are relevant to you.", justify=CENTER, fill='#020202', font=soleil) | |
var1 = IntVar(value=0) | |
chk1 = Checkbutton(canvas, text='Have you completed your 2018-2019 tax return?', variable=var1, style='Main.TCheckbutton', command=showEarningsInput) | |
chk1.place(x=300, y=200) | |
amountLabel = Label(canvas, text=" 2018-2019 income:", font=lato, background='#EDEDF3') | |
amountString = StringVar() | |
amountEntry = Entry(canvas, width=15, font=lato, textvariable=amountString) | |
var2 = IntVar(value=0) | |
chk2 = Checkbutton(canvas, text='Do you have children 16 or under listed as dependent on your tax return?', variable=var2, style='Main.TCheckbutton', command=showChildrenInput) | |
chk2.place(x=300, y=250) | |
childrenLabel = Label(canvas, text=" Number of children:", font=lato, background='#EDEDF3') | |
childrenString = StringVar() | |
childrenEntry = Entry(canvas, width=15, font=lato, textvariable=childrenString) | |
var3 = IntVar() | |
chk3 = Checkbutton(canvas, text='Do you have a valid social security number?', variable=var3, style='Main.TCheckbutton') | |
chk3.place(x=300, y=300) | |
var4 = IntVar() | |
chk4 = Checkbutton(canvas, text="Are you listed as dependent on your parent's tax return?", variable=var4, style='Main.TCheckbutton') | |
chk4.place(x=300, y=350) | |
var5 = IntVar() | |
chk5 = Checkbutton(canvas, text='Are you receiving unemployment insurance?', variable=var5, style='Main.TCheckbutton') | |
chk5.place(x=300, y=400) | |
nextBtn = Button(canvas, text='FINISH', style='Next.TButton', command=UsIndNextButton) | |
nextBtn.place(x=715, y=575); | |
exitBtn = Button(canvas, text='EXIT', style='Exit.TButton', command=UsIndExitButton) | |
exitBtn.place(x=400, y=575); | |
canvas.create_text(388, 660, text="Progress: 40%", justify=LEFT, fill='#020202', font=lato) | |
canvas.create_rectangle(320, 680, 960, 695, fill='#90929C', outline='#90929C') | |
canvas.create_rectangle(320, 680, 576, 695, fill='#6558F5', outline='#6558F5') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment