Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- from tkinter import *
- import datetime
- import os
- location = "X:\Sales\Shortcuts\ShiftReportsAR.txt"
- locationWrite = "X:\Sales\Shortcuts\ShiftReportsResultAR.txt"
- now = datetime.datetime.now()
- NiceNow = now.strftime("%Y-%m-%d at %H:%M:%S")
- Login = os.getenv('username')
- master = Tk()
- master.configure(background='#b3e6cc')
- master.title("Shift Report Widget - Remi Mahmoud Edition")
- foo = StringVar()
- e = Entry(master, textvariable=foo, width=100)
- e.pack()
- e.focus_set()
- def Write():
- global location
- now = datetime.datetime.now()
- NiceNow = now.strftime("%Y-%m-%d at %H:%M:%S")
- lblInst = Label(master, text="Shift Report Logged, on %s." % NiceNow, background='#b3e6cc', font=("Helvetica", 12))
- #clear_text()
- typedSR = e.get()
- if not typedSR:
- return
- with open(location, 'a') as file:
- file.write(str(Login) + " - " + str(NiceNow) + ": " +typedSR +"\n\n")
- clear_text()
- lblInst.pack()
- def OpenFile():
- global location
- os.startfile(location)
- sendButton = Button(master, text = "Send", bg="lightyellow", command = Write)
- sendButton.pack()
- openButton = Button(master, text = "Open File", bg="#d9d9d9", command = OpenFile)
- openButton.pack()
- quitButton = Button(master, text="Quit", bg="pink",
- command=master.quit)
- quitButton.pack()
- mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement