display window reaction time

NJM njm at rectec.net
Sun Oct 21 22:05:00 EDT 2001


This is a scheduled file launch program.  It lauches a file of my spec at a
specific time.

I am having one problem though.  When I try to use another toplevel widget
to display the statis, the reaction time of the widget prevents the display
until after the file is launched.

Does any one have a way around this???

Thanks for the input...









import Tkinter, time, os

def starttmer():
  global hour, minute, file
  hour = int(Tkinter.Entry.get(hourentry))
  minute =  int(Tkinter.Entry.get(minentry))
  file = Tkinter.Entry.get(fileentry)
  process()

def wait(timeinseconds):
  time.sleep(timeinseconds)

def process():
  tmer = time.localtime()
  if tmer[3] == hour and tmer[4] == minute:
    os.startfile(file)
  elif tmer[3] == hour and tmer[4] ==minute -1:
     Tkinter.Wm.iconify(root)
     wait(1)
     process()
  else:
     Tkinter.Wm.iconify(root)
     wait(1)
     process()


root = Tkinter.Tk()


frame1 = Tkinter.Frame(root)
frame1.pack()

frame2 = Tkinter.Frame(root, borderwidth=10)
frame2.pack()

frame3 = Tkinter.Frame(root)
frame3.pack()


filelabel = Tkinter.Label(frame1, text = 'Enter the file you want started
here')
filelabel.pack()

fileentry = Tkinter.Entry(frame1, width = 60)
fileentry.pack()

timelabel = Tkinter.Label(frame1,borderwidth = 10,  text = 'Enter the time
you want the file started \n please use 24 hour time')
timelabel.pack()

hourlabel = Tkinter.Label(frame2, text="Start hour")
hourlabel.pack(side=Tkinter.LEFT)
hourentry = Tkinter.Entry(frame2, width=5)
hourentry.pack(side=Tkinter.LEFT)

minlabel=Tkinter.Label(frame2, text="Start minute")
minlabel.pack(side=Tkinter.LEFT)
minentry = Tkinter.Entry(frame2, width=5)
minentry.pack(side=Tkinter.LEFT)

startbut= Tkinter.Button(frame3, text="Start timer", command = starttmer)
startbut.pack(side=Tkinter.LEFT)

cancelbut=Tkinter.Button(frame3, text="Cancel", command = root.destroy)
cancelbut.pack(side=Tkinter.LEFT)





root.mainloop()






More information about the Python-list mailing list