Sunday, 29 September 2013

Another thread for prevent freezing

Another thread for prevent freezing

I need to put this def in another process because shutil when work
freezing the graphic interface:
def creabackuno():
startbar()
messagebox.showinfo( "Wait..","I am creating the backup, please wait...")
try:
copytree(path,r"backup\dirbackup1\.minecraft")
messagebox.showinfo( "OK!","Backup (1) created!")
stopbar()
except OSError:
messagebox.showerror( "Nope!","There is already a backup to restore")
stopbar()
I have tried with this but not work and the programm crash:
def creabackuno():
startbar()
messagebox.showinfo( "Wait..","I am creating the backup, please wait...")
try:
copytree(path,r"backup\dirbackup1\.minecraft")
messagebox.showinfo( "OK!","Backup (1) created!")
stopbar()
except OSError:
messagebox.showerror( "Nope!","There is already a backup to restore")
stopbar()
def startprocess():
t=threading.Thread(target=creabackuno)
t.start()
(startbar() and stopbar() start/stop the prgress bar in indeterminate
mode, the problem is the interface freezing and the progressbar not work)
I'm using python 3.3
sorry for my poor english
thanks

No comments:

Post a Comment