-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopenGOALModLauncher.py
586 lines (502 loc) · 23.7 KB
/
openGOALModLauncher.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 25 18:33:45 2022
@author: Zed
"""
# img_viewer.py
# we will clean these up later but for now even leave unused imports
#we are not in cleanup phase yet
from PIL import Image
from utils import launcherUtils, githubUtils
import PySimpleGUI as sg
import cloudscraper
import io
import json
import os.path
import requests
import sys
import webbrowser
import os
from os.path import exists
import urllib.request
import shutil
from appdirs import AppDirs
# Folder where script is placed, It looks in this for the Exectuable
if getattr(sys, 'frozen', False):
LauncherDir = os.path.dirname(os.path.realpath(sys.executable))
elif __file__:
LauncherDir = os.path.dirname(__file__)
installpath = str(LauncherDir + "\\resources\\")
#intialize default variables so they are never null
currentModderSelected = None
currentModSelected = None
currentModURL = None
currentModImage = None
steamDIR = None
dirs = AppDirs(roaming=True)
AppdataPATH = os.path.join(dirs.user_data_dir, "OPENGOAL-UnofficalModLauncher","")
ModFolderPATH = os.path.join(dirs.user_data_dir, "OpenGOAL-Mods","")
print()
#comment this out if you want to test with a local file
moddersAndModsJSON = requests.get("https://raw.githubusercontent.com/OpenGOAL-Unofficial-Mods/OpenGoal-ModLauncher-dev/main/resources/ListOfMods.json").json()
j_file = json.dumps(moddersAndModsJSON)
#print(moddersAndModsJSON["Modding Community"][0]["name"])
#print(moddersAndModsJSON["Modding Community"][0]["URL"])
# First the window layout in 2 columns
installed_mods_column = [
[sg.Text("Installed Mods", font=("Helvetica", 14))],
[sg.Listbox(values=["This List is not", "Classic+"],size=(40,5),key="InstalledModListBox",enable_events=True)],
[
sg.Btn(button_text="Refresh"),
sg.Btn(button_text="Uninstall"),
sg.Btn(button_text="Add to Steam",key='AddToSteam',enable_events=True)
],
]
mod_list_column = [
[sg.Text("Available Mods", font=("Helvetica", 14))],
[sg.Text("Mod Creator")],
[sg.Combo(list(moddersAndModsJSON.keys()), enable_events=True, key='pick_modder', size=(40, 0))],
[sg.Text("Their Mods")],
[sg.Combo([], key='pick_mod', size=(40, 0),enable_events=True)],
[sg.Btn(button_text="Search Available mods",key='mod_search')]
]
mod_details_column = [
[sg.Text("Selected Mod", font=("Helvetica", 14))],
[
sg.Text("", key="-SELECTEDMOD-"),
sg.Text("", key="-SELECTEDMODURL-", visible=False)
],
[sg.Text("", key="-SELECTEDMODDESC-")],
[sg.Image(key="-SELECTEDMODIMAGE-")],
[
sg.Btn(button_text="Launch!"),
sg.Btn(button_text="View Folder",key="ViewFolder_1"),
sg.Btn(button_text="Reinstall",key="Reinstall_1"),
sg.Btn(button_text="Uninstall",key="Uninstall_1"),
sg.Btn(button_text="View mod on github!",key="-GITHUB-_1")
]
]
# ----- Full layout -----
layout = [
[sg.Column([
[sg.Column(installed_mods_column)],
[sg.HSeparator()],
[sg.Column(mod_list_column)],
]),
sg.VSeparator(),
sg.Column(mod_details_column)]
]
sg.theme('Python')
url= "https://raw.githubusercontent.com/OpenGOAL-Unofficial-Mods/OpenGoal-ModLauncher-dev/main/appicon.ico"
jpg_data = (
cloudscraper.create_scraper(
browser={"browser": "firefox", "platform": "windows", "mobile": False}
)
.get(url)
.content
)
pil_image = Image.open(io.BytesIO(jpg_data))
png_bio = io.BytesIO()
pil_image.save(png_bio, format="PNG")
iconfile = png_bio.getvalue()
url= "https://raw.githubusercontent.com/OpenGOAL-Unofficial-Mods/OpenGoal-ModLauncher-dev/main/resources/noRepoImageERROR.png"
jpg_data = (
cloudscraper.create_scraper(
browser={"browser": "firefox", "platform": "windows", "mobile": False}
)
.get(url)
.content
)
pil_image = Image.open(io.BytesIO(jpg_data))
png_bio = io.BytesIO()
pil_image.save(png_bio, format="PNG")
noimagefile = png_bio.getvalue()
window = sg.Window('OpenGOAL Mod Launcher v0.03', layout, icon = iconfile, finalize=True)
window.Element('AddToSteam').Update(visible = False)
def bootup():
print("BOOT")
#installed mods
if not os.path.exists(ModFolderPATH):
print("Creating Mod dir: " + AppdataPATH)
os.makedirs(ModFolderPATH)
subfolders = [ f.name for f in os.scandir(ModFolderPATH) if f.is_dir() ]
if subfolders == []:
subfolders = ["No Mods Installed"]
#print(subfolders)
window["InstalledModListBox"].update(subfolders)
print()
if subfolders == [] or subfolders[0] == "No Mods Installed":
#default mod selection on boot
window['-SELECTEDMODIMAGE-'].update(githubUtils.resize_image(noimagefile ,resize=(1,1)))
item = "Modding Community"
window['pick_modder'].update(item)
title_list = [i["name"] for i in moddersAndModsJSON[item]]
window['pick_mod'].update(value=title_list[0], values=title_list)
currentModderSelected = "Modding Community"
currentModSelected = "Randomizer"
currentModURL = "https://github.com/OpenGOAL-Unofficial-Mods/opengoal-randomizer-mod-pack/tree/main"
currentModImage = None
[currentModderSelected, currentModSelected, currentModURL, currentModImage] = handleModSelected()
if subfolders != [] and subfolders[0] != "No Mods Installed":
#if there is a mod installed, use the first one in the list on boot.
for modder in moddersAndModsJSON.keys():
for mod in moddersAndModsJSON[modder]:
if mod["name"] == subfolders[0]:
currentMOD = modder
print(currentMOD)
window['-SELECTEDMODIMAGE-'].update(githubUtils.resize_image(noimagefile ,resize=(1,1)))
item = currentMOD
window['pick_modder'].update(item)
title_list = [i["name"] for i in moddersAndModsJSON[item]]
#below is not correct but it does work.
window['pick_mod'].update(value=subfolders[0], values=title_list)
currentModderSelected = modder
currentModSelected = subfolders[0]
currentModURL = "https://github.com/OpenGOAL-Unofficial-Mods/opengoal-randomizer-mod-pack/tree/main"
currentModImage = None
[currentModderSelected, currentModSelected, currentModURL, currentModImage] = handleModSelected()
if window['-SELECTEDMOD-'].get().lower() == "local multiplayer (beta) + randomizer":
window.Element('AddToSteam').Update(visible = True)
else:
window.Element('AddToSteam').Update(visible = False)
def handleModSelected():
tmpModderSelected = window['pick_modder'].get()
tmpModSelected = window['pick_mod'].get()
tmpModURL = None
tmpModDesc = "<No description available>"
tmpModImage = None
print("\nLoading new mod selection one moment...")
for mod in moddersAndModsJSON[tmpModderSelected]:
if mod["name"] == tmpModSelected:
tmpModURL = mod["URL"]
if mod.get("desc"):
tmpModDesc = mod["desc"]
tmpModImage = githubUtils.returnModImageURL(tmpModURL)
url = tmpModImage
try:
r = requests.head(tmpModImage).status_code
if r != 200:
print(str(r))
if r == 200:
jpg_data = (
cloudscraper.create_scraper(
browser={"browser": "firefox", "platform": "windows", "mobile": False}
)
.get(url)
.content
)
pil_image = Image.open(io.BytesIO(jpg_data))
png_bio = io.BytesIO()
pil_image.save(png_bio, format="PNG")
png_data = png_bio.getvalue()
window['-SELECTEDMODIMAGE-'].update(githubUtils.resize_image(png_data ,resize=(250,250)))
# prints the int of the status code. Find more at httpstatusrappers.com :)
else:
window['-SELECTEDMODIMAGE-'].update(githubUtils.resize_image(noimagefile ,resize=(250,250)))
print("Done Loading new mod selection")
changePlayInstallButtonText()
except requests.exceptions.MissingSchema:
window['-SELECTEDMODIMAGE-'].update(githubUtils.resize_image(noimagefile ,resize=(250,250)))
window['-SELECTEDMOD-'].update(tmpModSelected)
window['-SELECTEDMODDESC-'].update(tmpModDesc)
window['-SELECTEDMODURL-'].update(tmpModURL)
if tmpModSelected.lower() == "local multiplayer (beta) + randomizer":
window.Element('AddToSteam').Update(visible = True)
else:
window.Element('AddToSteam').Update(visible = False)
return [tmpModderSelected, tmpModSelected, tmpModURL, tmpModImage]
def handleInstalledModSelected():
if len(window['InstalledModListBox'].get()) == 0:
return [None, None]
tmpModSelected = window['InstalledModListBox'].get()[0]
tmpModderSelected = None
for modder in moddersAndModsJSON.keys():
if not tmpModderSelected:
for mod in moddersAndModsJSON[modder]:
if mod["name"] == tmpModSelected:
tmpModderSelected = modder
break
return [tmpModderSelected, tmpModSelected]
def changePlayInstallButtonText():
subfolders = [ f.name for f in os.scandir(ModFolderPATH) if f.is_dir() ]
if not window['pick_mod'].get() in subfolders:
window['Launch!'].update('Install')
window['Uninstall'].update(disabled=True)
window['ViewFolder_1'].update(disabled=True)
window['Reinstall_1'].update(disabled=True)
window['Uninstall_1'].update(disabled=True)
else:
window['Launch!'].update('Launch!')
window['Uninstall'].update(disabled=False)
window['ViewFolder_1'].update(disabled=False)
window['Reinstall_1'].update(disabled=False)
window['Uninstall_1'].update(disabled=False)
def refreshInstalledList():
subfolders = [ f.name for f in os.scandir(ModFolderPATH) if f.is_dir() ]
window["InstalledModListBox"].update(subfolders)
def open_steamPrompt():
filelayout = [ [sg.FolderBrowse("Select Steam Directory",enable_events=True,key="PICKSTEAMDIR")]]
filewindow = sg.Window('Search for offered mods', filelayout, keep_on_top=True,icon = iconfile, size=window.size,location = window.CurrentLocation())
# Event Loop
while True:
event, values = filewindow.read()
print(event)
print(values[event])
if event in (sg.WIN_CLOSED, 'Exit'): # always check for closed window
break
if exists(values[event]+"/steam.exe"):
print("FOUND STEAM DIR")
print(values[event])
steamDIR = values[event]
print(steamDIR)
filewindow.close()
return steamDIR
else:
sg.popup("Did not find Steam install Directory try again",keep_on_top=True)
else:
filewindow.close()
def open_search():
names = []
for modder in moddersAndModsJSON.keys():
for mod in moddersAndModsJSON[modder]:
if not mod["name"] in names:
names.append(mod["name"])
layout = [[sg.Text('Search for offered mods')],
[sg.Input(size=window.size, enable_events=True, key='-INPUT-')],
[sg.Listbox(names, size=window.size, enable_events=True, key='-LIST-')],
[sg.Button('Chrome'), sg.Button('Exit')]]
window2 = sg.Window('Search for offered mods', layout, keep_on_top=True,icon = iconfile, size=window.size,location = window.CurrentLocation())
# Event Loop
while True:
event, values = window2.read()
if event in (sg.WIN_CLOSED, 'Exit'): # always check for closed window
break
if values['-INPUT-'] != '': # if a keystroke entered in search field
search = values['-INPUT-'].lower()
new_values = [x for x in names if search.lower() in x.lower()] # do the filtering
window2['-LIST-'].update(new_values) # display in the listbox
print(len(values['-LIST-']))
if event == '-LIST-':
print(values['-LIST-'][0])
print("was CLICKED!")
currentMOD = "unkown"
p=0
for modder in moddersAndModsJSON.keys():
for mod in moddersAndModsJSON[modder]:
print(mod["name"])
print(values['-LIST-'][0])
if mod["name"].lower() == values['-LIST-'][0].lower():
print("MATCH")
indexOfMod = p
currentMOD = modder
print(currentMOD)
item = currentMOD
window['pick_modder'].update(item)
title_list = [i["name"] for i in moddersAndModsJSON[item]]
p=-1
for title in title_list:
p=p+1
if title == values['-LIST-'][0]:
print("MATCH")
indexOfMod = p
window['pick_mod'].update(value=title_list[indexOfMod], values=title_list)
handleModSelected()
window2.close()
#sg.popup('Selected ', values['-LIST-'], keep_on_top=True,icon = iconfile)
else:
# display original unfiltered list
window2['-LIST-'].update(names)
# if a list item is chosen
print(len(values['-LIST-']))
if event == '-LIST-':
print(values['-LIST-'][0])
print("was CLICKED!")
currentMOD = "unkown"
for modder in moddersAndModsJSON.keys():
for mod in moddersAndModsJSON[modder]:
print(mod["name"])
print(values['-LIST-'][0])
if mod["name"].lower() == values['-LIST-'][0].lower():
print("MATCH")
currentMOD = modder
print(currentMOD)
item = currentMOD
window['pick_modder'].update(item)
title_list = [i["name"] for i in moddersAndModsJSON[item]]
p=-1
for title in title_list:
p=p+1
if title == values['-LIST-'][0]:
print("MATCH")
indexOfMod = p
window['pick_mod'].update(value=title_list[indexOfMod], values=title_list)
handleModSelected()
window2.close()
#sg.popup('Selected ', values['-LIST-'], keep_on_top=True,icon = iconfile)
window2.close()
bootupcount = 0
# Run the Event Loop
if bootupcount == 0:
bootup()
while True:
event, values = window.read()
if event == "Exit" or event == sg.WIN_CLOSED:
break
# Folder name was filled in, make a list of files in the folder
if event == "InstalledModListBox" and not window["InstalledModListBox"].get() == ['No Mods Installed']:
[tmpModderSelected, tmpModSelected] = handleInstalledModSelected()
if not tmpModderSelected:
sg.Popup('Installed mod not found in available mods!', keep_on_top=True, icon = iconfile)
window['-SELECTEDMOD-'].update(tmpModSelected)
window['-SELECTEDMODDESC-'].update("<No description available>")
window['-SELECTEDMODURL-'].update("")
local_img = launcherUtils.local_mod_image(tmpModSelected)
if local_img:
window['-SELECTEDMODIMAGE-'].update(githubUtils.resize_image(local_img ,resize=(250,250)))
else:
window['-SELECTEDMODIMAGE-'].update(githubUtils.resize_image(noimagefile ,resize=(250,250)))
else:
window['pick_modder'].update(tmpModderSelected)
title_list = [i["name"] for i in moddersAndModsJSON[tmpModderSelected]]
window['pick_mod'].update(value=tmpModSelected, values=title_list)
handleModSelected()
elif event == "Refresh":
refreshInstalledList()
if (len(window['InstalledModListBox'].get())) == 0:
bootup()
elif event =='pick_modder':
window['-SELECTEDMODIMAGE-'].update(githubUtils.resize_image(noimagefile ,resize=(1,1)))
item = values[event]
print("\nChaning to this modder")
print(item)
print("Done!")
title_list = [i["name"] for i in moddersAndModsJSON[item]]
window['pick_mod'].update(value=title_list[0], values=title_list)
handleModSelected()
elif event =='pick_mod':
handleModSelected()
elif event == 'mod_search':
open_search()
elif event == "Launch!":
tmpModSelected = window['-SELECTEDMOD-'].get()
tmpModURL = window['-SELECTEDMODURL-'].get()
if tmpModURL:
# online launch
window['Launch!'].update(disabled=True)
window['Launch!'].update('Updating...')
[linkType, tmpModURL] = githubUtils.identifyLinkType(tmpModURL)
launcherUtils.launch(tmpModURL, tmpModSelected, linkType)
#turn the button back on
window['Launch!'].update('Launch!')
window['Launch!'].update(disabled=False)
#may have installed new mod, update list
refreshInstalledList()
elif tmpModSelected:
# local launch
window['Launch!'].update(disabled=True)
err = launcherUtils.launch_local(tmpModSelected)
if err:
sg.popup("Error: " + err, icon = iconfile)
#turn the button back on
window['Launch!'].update(disabled=False)
else:
bootup()
sg.Popup('No mod selected', keep_on_top=True, icon = iconfile)
elif event == "ViewFolder_1":
tmpModSelected = window['-SELECTEDMOD-'].get()
tmpModURL = window['-SELECTEDMODURL-'].get()
subfolders = [ f.name for f in os.scandir(ModFolderPATH) if f.is_dir() ]
if subfolders == []:
subfolders = ["No Mods Installed"]
if tmpModSelected and not tmpModSelected == "No Mods Installed" and tmpModSelected in subfolders:
print(tmpModSelected)
dir = dirs.user_data_dir + "\\OpenGOAL-Mods\\" + tmpModSelected
launcherUtils.openFolder(dir)
else:
if (len(window['InstalledModListBox'].get())) == 0:
bootup()
sg.Popup('No installed mod selected', keep_on_top=True,icon = iconfile)
elif event == "Reinstall_1":
tmpModSelected = window['-SELECTEDMOD-'].get()
tmpModURL = window['-SELECTEDMODURL-'].get()
subfolders = [ f.name for f in os.scan(ModFolderPATH) if f.is_dir() ]
if subfolders == []:
subfolders = ["No Mods Installed"]
if tmpModSelected and not tmpModSelected == "No Mods Installed" and tmpModSelected in subfolders:
print(tmpModSelected)
dir = dirs.user_data_dir + "\\OpenGOAL-Mods\\" + tmpModSelected
ans = sg.popup_ok_cancel('Confirm: reinstalling ' + dir + " \n\nNote: this will re-extract texture_replacements too",icon = iconfile)
if ans == 'OK':
launcherUtils.reinstall(tmpModSelected)
refreshInstalledList()
if (len(window['InstalledModListBox'].get())) == 0:
bootup()
else:
if (len(window['InstalledModListBox'].get())) == 0:
bootup()
sg.Popup('No installed mod selected', keep_on_top=True,icon = iconfile)
elif event == "Uninstall" or event =="Uninstall_1":
tmpModSelected = window['-SELECTEDMOD-'].get()
tmpModURL = window['-SELECTEDMODURL-'].get()
subfolders = [ f.name for f in os.scandir(ModFolderPATH) if f.is_dir() ]
if subfolders == []:
subfolders = ["No Mods Installed"]
if tmpModSelected and not tmpModSelected == "No Mods Installed" and tmpModSelected in subfolders:
print(tmpModSelected)
dir = dirs.user_data_dir + "\\OpenGOAL-Mods\\" + tmpModSelected
ans = sg.popup_ok_cancel('Confirm: uninstalling ' + dir ,icon = iconfile)
if ans == 'OK':
launcherUtils.try_remove_dir(dir)
refreshInstalledList()
if (len(window['InstalledModListBox'].get())) == 0:
bootup()
window['-SELECTEDMOD-'].update("")
window['-SELECTEDMODDESC-'].update("")
window['-SELECTEDMODURL-'].update("")
window['-SELECTEDMODIMAGE-'].update(githubUtils.resize_image(noimagefile ,resize=(1,1)))
sg.popup('Uninstalled ' + tmpModSelected,icon = iconfile)
if (len(window['InstalledModListBox'].get())) == 0:
bootup()
else:
if (len(window['InstalledModListBox'].get())) == 0:
bootup()
sg.Popup('No installed mod selected', keep_on_top=True,icon = iconfile)
elif event == "-GITHUB-_1":
window = window.refresh()
url = window['-SELECTEDMODURL-'].get()
if url:
webbrowser.open(url)
elif event == "AddToSteam":
print("STEAM BUTTON HIT")
if exists(r"C:\Program Files (x86)\Steam"):
steamDIR = r"C:\Program Files (x86)\Steam"
print("FOUND STEAM DIR")
else:
print("trying to find it")
steamDIR = open_steamPrompt()
if exists(steamDIR + "\steamapps\common\Play With Gilbert"):
print("FOUND GILBERT")
if sg.PopupYesNo('Do you want to replace Play With Gilbert with the unoffical Mod Launcher?') == "Yes":
print("Preparing to replace Gilbert")
launcherUtils.try_remove_file(steamDIR + "\steamapps\common\Play With Gilbert\PlayWithGilbert.exe")
autoUpdaterURL = "https://github.com/OpenGOAL-Unofficial-Mods/OpenGOAL-Unofficial-Mods.github.io/raw/main/Launcher%20with%20autoupdater.exe"
print("Downloading update from " + autoUpdaterURL)
file = urllib.request.urlopen(autoUpdaterURL)
print()
print(str("File size is ") + str(file.length))
urllib.request.urlretrieve(autoUpdaterURL, "PlaywithGilbert.exe", launcherUtils.show_progress)
print("Done downloading")
print("moving to steam")
shutil.move("PlaywithGilbert.exe", steamDIR + "\steamapps\common\Play With Gilbert\\")
if sg.PopupYesNo('Do you ever want to play the real Play with Gilbert') == "Yes":
sg.Popup("Ok we will leave the Play with Gilbert files")
else:
sg.Popup("Ok removing the play with gilbert game files to save space. ( :( )")
launcherUtils.try_remove_dir(steamDIR + "\steamapps\common\Play With Gilbert\Engine")
launcherUtils.try_remove_dir(steamDIR + "\steamapps\common\Play With Gilbert\PWG_2020")
sg.Popup("Mod Launcher added to steam, launch by playing \"Play with Gilbert\" in Steam.")
else:
sg.Popup("Understandable")
else:
sg.Popup("Did not find play with gilbert please download from " + "https://store.steampowered.com/app/1359630/Play_With_Gilbert__A_Small_Tail" , keep_on_top=True,icon = iconfile)
window.close()