python how to make your application check for updates

Solutions on MaxInterview for python how to make your application check for updates by the best coders in the world

showing results for - "python how to make your application check for updates"
Davide
23 Jul 2017
1import Tkinter
2import urllib
3
4def updateCheck(self):
5    update = False
6
7    updateWindow = Tkinter.Toplevel()
8    updateWindow.title(string="Update Checker")
9    updateWindow.resizable(False, False)
10
11    #Gets downloaded version
12    versionSource = open('version.txt', 'r')
13    versionContents = versionSource.read()
14
15    #gets newest version
16    updateSource = urllib.urlopen("http://www.suturesoft.com/Updates/craftbook.txt")
17    updateContents = updateSource.read()
18
19    #checks for updates
20    for i in range(0,20):
21        if updateContents[i] != versionContents[i]:
22            dataLabel = Tkinter.Label(updateWindow,text="\n\nThere are data updates availible.\n\n")
23            dataLabel.pack()
24            update = True
25            break
26    for i in range(22,42):
27        if updateContents[i] != versionContents[i]:
28            versionLabel = Tkinter.Label(updateWindow,text="\n\nThere are version updates availible.\n\n")
29            versionLabel.pack()
30            update = True
31            break
32    if update == False:
33        versionLabel = Tkinter.Label(updateWindow,text="\n\nYou are already running the most up to date version.\n\n")
34        versionLabel.pack()
35