python form almost complete need to add pandas logic

This commit is contained in:
darkicewolf50 2023-10-21 17:04:45 -06:00
parent 1e49a30113
commit c2e8c11ee3
2 changed files with 82 additions and 12 deletions

View File

@ -1,21 +1,91 @@
import pandas as pd
import os
from tkinter import *
from tkinter import messagebox
from tkinter import filedialog as fd
#https://www.geeksforgeeks.org/python-gui-tkinter/
from tkinter import *
form_window = Tk()
form_window.title("Reinbusement Form")
receipt_file = 0
new_form = Menu(form_window)
new_form.add_command(label='New')
Label(form_window, text='Name (Last name if there is someone who shares your name)').grid(row=0)
Label(form_window, text='Final Total on reciept $(CAD)').grid(row=1)
person_name = Entry(form_window, text='Scott Webber')
amount_CAD = Entry(form_window)
person_name.grid(row=0, column=1)
amount_CAD.grid(row=1, column=1)
mainloop()
def submit_window():
form_window = Tk()
form_window.title("Reinbursement Form")
row_counter = 0
new_form = Menu(form_window)
new_form.add_command(label='New')
Label(form_window, text="This standardizes all of our reciepts that we recieve and logs \nthem away so that we can easily get the money you \nspent on the club back to you.", anchor='w', justify='left').grid(row=row_counter, rowspan=2, columnspan=2)
row_counter += 2
Label(form_window, text="Please put the amount on the reciept we will split the bill on \nfood for you no need to go through mental gymnatics", anchor='w', justify='left').grid(row=row_counter, rowspan=2, columnspan=2)
row_counter += 2
Label(form_window, text=" ").grid(row=row_counter, columnspan=2)
row_counter += 1
Label(form_window, text='Name (Last name if there is \nsomeone who shares your name)', anchor='w', justify='left').grid(row=row_counter)
person_name = Entry(form_window)
person_name.grid(row=row_counter, column=1)
row_counter += 1
Label(form_window, text='Final Total on reciept $(CAD)', anchor='w', justify='left').grid(row=row_counter)
amount_CAD = Entry(form_window)
amount_CAD.grid(row=row_counter, column=1)
row_counter += 1
Label(form_window, text='Reason (optional)', justify='left').grid(row=row_counter)
reason = Entry(form_window)
reason.grid(row=row_counter, column=1)
row_counter += 1
Label(form_window, text='Picture or PDF or reciept', justify='left').grid(row=row_counter)
selected_file = Label(form_window, text="", anchor='w', justify='left')
selected_file.grid(row=row_counter, column=1)
row_counter += 1
open_button = Button(form_window, text='Browse...' , command=lambda:select_file(selected_file, receipt_file)).grid(row=row_counter, column=1)
row_counter += 1
Button(form_window, text='Submit', command=lambda:submitted(), anchor='w', justify='left').grid(row=row_counter)
row_counter += 1
mainloop()
def submitted():
#add pandas for excell file input
messagebox.showinfo(title='Submitted', message='You have successfully submitted')
def select_file(tk_window, select_file):
filetypes = (
('PDF file', '*.pdf'),
('PNG file', '*.png'),
('JPEG file', '*.jpeg'),
('JPG file', '*.jpg')
)
file_name = fd.askopenfilename(
title='Open a file',
filetypes=filetypes)
if(file_name != None):
messagebox.showinfo(
title='Selected File',
message=file_name
)
select_file = file_name
formatted_file_name = os.path.basename(file_name)
tk_window["text"] = formatted_file_name
else:
messagebox.showinfo(
title="No selected file",
message="Please select a file"
)
if __name__ == "__main__":
submit_window()

Binary file not shown.