Commits

Long Yang committed d6f45ed

change btn text and command

  • Participants
  • Parent commits 7545f83

Comments (0)

Files changed (1)

 def start():
     global period
     period = 1000*60*int(e.get())
-    root.after(period, log)
-    btn['state'] = DISABLED
+    ## btn['state'] = DISABLED
     e.delete(0, END)
     e.focus_set()
+    btn['text'] = 'Set'
+    btn['command'] = save
     try:
         os.mkdir(curdir+os.sep+time.strftime('%y-%m-%d'))
     except:pass
     root.wm_attributes('-topmost', 1)
     e.selection_range(0, END)
     e.focus_set()
-    root.after(period, log)
     
-def save(event):
+def save(event=None):
     t = time.strftime('%Y-%m-%d_%H:%M:%S')
     fn = curdir+os.sep+time.strftime('%y-%m-%d')+os.sep+'activity.txt'
     f = open(fn, 'ab+')
     im = ImageGrab.grab()
     im.save(curdir+os.sep+time.strftime('%y-%m-%d')+os.sep+time.strftime('%H-%M-%S')+'.jpg', "JPEG")
     
+    root.after(period, log)
+    
 if __name__ == '__main__':
     root = Tk()
     root.title(u'logger')
-    w,h,x,y = 220,60,360,360
+    w,h,x,y = 220,70,360,360
     root.geometry('%dx%d+%d+%d' % (w, h, x, y))
     ## root.wm_attributes('-topmost', 1)
     
     period = 0
     curdir = os.path.dirname(os.path.abspath(__file__))
     
-    btn = Button(root, text='start', command=start)
+    btn = Button(root, text='Start', command=start, width=13, height=2)
     btn.pack()
     
     root.mainloop()