Advertisement
Guest User

Basic GUI for shell commands with Python Tk threading and os

a guest
Jul 4th, 2011
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.73 KB | None | 0 0
  1. import sys
  2. from Tkinter import *
  3. from os import system as run
  4. from time import sleep
  5. import thread
  6.  
  7. r = Tk()
  8. r.title('Remote Support')
  9. t = StringVar()
  10. t.set('Completing Remote Support Initalisation         ')
  11. l = Label(r,  textvariable=t).pack()
  12. def quit():
  13.     #do cleanup if any
  14.     r.destroy()
  15. but = Button(r, text='Stop Remote Support', command=quit)
  16. but.pack(side=LEFT)
  17.  
  18. def d():
  19.     sleep(2)
  20.     t.set('Completing Remote Support Initalisation, downloading, please wait         ')
  21.     run('sleep 5') #test shell command
  22.     t.set('Preparing to run download, please wait         ')
  23.     run('sleep 5')
  24.     t.set("OK thanks! Remote Support will now close         ")
  25.     sleep(2)
  26.     quit()
  27.  
  28. sleep(2)
  29. thread.start_new_thread(d,())
  30. r.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement