SHARE
TWEET

Untitled

a guest Jul 12th, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # -*- coding: utf-8 -*-
  2.  
  3. from tkinter import *
  4. import datetime
  5. import os
  6.  
  7. location = "X:\Sales\Shortcuts\ShiftReportsAR.txt"
  8. locationWrite = "X:\Sales\Shortcuts\ShiftReportsResultAR.txt"
  9. now = datetime.datetime.now()
  10. NiceNow = now.strftime("%Y-%m-%d at %H:%M:%S")
  11. Login = os.getenv('username')
  12.  
  13. master = Tk()
  14. master.configure(background='#b3e6cc')
  15. master.title("Shift Report Widget - Remi Mahmoud Edition")
  16. foo = StringVar()
  17.  
  18. e = Entry(master, textvariable=foo, width=100)
  19. e.pack()
  20. e.focus_set()
  21.  
  22.  
  23. def Write():  
  24.     global location
  25.     now = datetime.datetime.now()
  26.     NiceNow = now.strftime("%Y-%m-%d at %H:%M:%S")
  27.     lblInst = Label(master, text="Shift Report Logged, on %s." % NiceNow, background='#b3e6cc', font=("Helvetica", 12))
  28.     #clear_text()
  29.     typedSR = e.get()
  30.     if not typedSR:
  31.         return
  32.  
  33.     with open(location, 'a') as file:
  34.         file.write(str(Login) + " - " + str(NiceNow) + ": " +typedSR +"\n\n")
  35.     clear_text()
  36.     lblInst.pack()
  37.  
  38.  
  39.  
  40.  
  41.  
  42. def OpenFile():
  43.     global location
  44.     os.startfile(location)
  45.  
  46.  
  47.    
  48. sendButton = Button(master, text = "Send", bg="lightyellow", command = Write)
  49.  
  50. sendButton.pack()
  51.  
  52. openButton = Button(master, text = "Open File", bg="#d9d9d9", command = OpenFile)
  53.  
  54. openButton.pack()
  55.  
  56.  
  57.  
  58. quitButton = Button(master, text="Quit", bg="pink",
  59.           command=master.quit)
  60. quitButton.pack()
  61.  
  62.  
  63.  
  64. mainloop()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top