Python Forum
autofill entries from a saved .txt file
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
autofill entries from a saved .txt file
#1
I just started learning python today, let alone any programming language. I have been watching videos and reading forums online for the last 15 hours.

Long story short, I run my families truck repair/upfitting company and I am wanting to get rid of all the papers with crap scribbled on them, I've looked for software and couldn't find anything for a decent price that is customizable to exactly what I want.... so I decided to try and learn how to code myself so I can get exactly what I want.

I think I have learned a lot in one day, but now I am stuck.
I have learned the "basics" of the basics. Enough to run a program with a gui, gather information, take that info and organize into a .txt file and save it to a new file name according to a certain variable + the date.


But now I am stuck and can not find any good tutorials on where to go next, if I make a "work order", hit submit, it'll save it as a new file. How would I go about opening that file and autofilling the entries that have already been filled, but still be able to fill in other entries that have not been filled in yet.

So far I only have two variables, the company name and contact name. But hopefully if I can get this figured out, there might be up to 100 different entries. Some might be filled in right away when the truck is first dropped off at the shop, other entries will be filled in here and there while the truck is in the shop. Such as the VIN or parts used on the truck.

I might be going about this the totally wrong way or have some things more complicated than they should be, I just started this today so any help would be appreciated. Thanks

here is my script so far
from tkinter import *
from datetime import datetime

#********************get variables and save as text file *******************

def submit():
    name_of_company = company_input.get()
    contact_name= contact_input.get()
    string_to_display ="Company name: " + name_of_company + "\nContact Name: " + contact_name
    company_label["text"]=string_to_display
    work_order = open(name_of_company + '  ' + fname + ' work order.txt', "w")
    print(work_order.write (string_to_display))
    work_order.close()


#***********import time*****************

import time,os

date=time.gmtime()
month = str(date.tm_mon).zfill(2)
day=str(date.tm_mday).zfill(2)
year=str(date.tm_year)[-2:]
fname = month + "-" + day + "-" + year

root = Tk()
root.geometry('400x300')

company_lab = Label(root, text="Company Name")
contact_lab = Label(root, text="Contact Name")
company_input = Entry(root)
contact_input = Entry(root)
company_label=Label(root)
submitbutt=Button(root,text="Submit", command=submit)
company_lab.grid(row=0)
contact_lab.grid(row=1)
submitbutt.grid(row=2,column=1)
company_input.grid(row=0, column=1)
contact_input.grid(row=1, column=1)


root.mainloop()
Reply
#2
Check out: https://pypi.org/search/?q=accounting
and it's homepage: https://github.com/ojengwa/accounting
Sounds similar to what your looking for
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020