Hello Everyone
Thanks for the message of welcome in a previous post. I have many questions but i have sleected this one as it represents my favourite piece of not working code (hahaha) but it has been studied and altered so i got this bugger working .. mostly .
Explain: I backup using 7zip, this works, and it works well, instead of the regular grab a dir and back it up, this does somethign more like .... seek out all the image types in the user folder of a windows machine then compress them up and store them.
So i have a main menu done with tkinter and i press the button, this button leads to this sexy piece of code
def picbackup():
source = ['-ir!"%USERPROFILE%\\*.jpg"', '-ir!"%USERPROFILE%\*.bmp"', '-ir!"%USERPROFILE%\*.tif"', '-ir!"%USERPROFILE%\\*.gif"']
target_dir = '.\\' # Remember to change this to what you will be using
today = time.strftime('%d_%m_%Y') # The current day is the name of the subdirectory in the main directory
target = '.\\Backup\Pictures_' + today + '.zip'
zip_command = "D:\\Backup\\7Zip\\7z.exe a -bd -ssw {0} {1}".format(target, ' '.join(source))
#
#
if os.system(zip_command) == 0:
print('Successful backup to', target)
else:
print('Backup FAILED')
ok .. this is the issue, while this is not yet compiled, i can see the output of this in my intepreter window so i can see 7zip doing it's job, but my original intention was for a window to pop up and display 7zips output in there, once complete, you could press OK and be back at the main menu. This was proving difficult to research so i switched to a simplier idea using some code i borrowed from a fella who made a ping GUI - and i shuffled my main menu to include a small live action output window so once you click the button, the backup will take place, but inside the output window the action should take place
The output window code looks like this
outputLabel = Label(root,text="7Zip Output Window")
outputLabel.place(x=500,y=425)
outputWindow = Text(root)
outputWindow.config(relief=SUNKEN, bg='beige',width=51,height=17)
outputWindow.place(x=350,y=130)
Problem is ... simply .... it doesn't work, i have tried to put certain combinations into the 7zip section like
shellOutput = zip_command.read()
zip_command.close()
outputWindow.delete('1.0',END)
outputWindow.insert('1.0',shellOutput)
that was between the # # and then 7zip doesn't do the backup no more.
Would love to hear some anyone about either opening a window to display the output with a OK when done or using my now created 7zip output window
Thanks for reading this .. it was alot :)