-
Notifications
You must be signed in to change notification settings - Fork 0
/
TIE-Suite.py
740 lines (611 loc) · 23.4 KB
/
TIE-Suite.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
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
import vlc
import os
import sys
import ctypes
from Tkinter import *
import ttk
from tkFileDialog import *
from threading import Thread, Event
import time
import platform
from openpyxl import *
import pathlib
from __builtin__ import file
import tkFileDialog
from openpyxl.styles.borders import Side
gridi = 0
gridj = 0
excelFile = ""
themeFile = ""
themeFile2 = ""
vidFile = ""
buttonDict = {}
themeBuild = {}
class ttkTimer(Thread):
"""a class serving same function as wxTimer... but there may be better ways to do this
"""
def __init__(self, callback, tick):
Thread.__init__(self)
self.callback = callback
self.stopFlag = Event()
self.tick = tick
self.iters = 0
def run(self):
while not self.stopFlag.wait(self.tick):
self.iters += 1
self.callback()
def stop(self):
self.stopFlag.set()
def get(self):
return self.iters
# Borrowed/Adapted from one of the open-source examples bundled with python-vlc
class Player(Frame):
"""The main window has to deal with events.
"""
def __init__(self, parent, title=None):
Frame.__init__(self, parent)
self.parent = parent
loadT1 = StringVar()
loadT2 = StringVar()
loadW = StringVar()
loadV = StringVar()
if title == None:
title = "Tie Sweet 1.3"
self.parent.title(title)
# Menu Bar
menubar = Menu(self.parent)
self.parent.config(menu=menubar)
# Menu for running suite
runMenu = Menu(menubar, tearoff=0)
runMenu.add_command(label="Play Video", underline=0, command=self.OnOpen)
runMenu.add_command(label="Launch TIE Coder - Client", command=lambda: playerInterface(self, "Client"))
runMenu.add_command(label="Launch TIE Coder - Counselor", command=lambda: playerInterface(self, "Counselor"))
runMenu.add_separator()
runMenu.add_command(label="Save and Quit", command=lambda: saveQuit(self))
menubar.add_cascade(label="Run", menu=runMenu)
# Create projMenu Menu List
projMenu = Menu(menubar, tearoff=0)
projMenu.add_command(label="Resume Project", command=lambda: resume(parent, loadT1, loadT2, loadW, loadV))
projMenu.add_command(label="Load Project", command=lambda: loadProj(parent, loadT1, loadT2, loadW, loadV))
projMenu.add_command(label="Save Project", command=lambda: saveProj(parent))
menubar.add_cascade(label="Project", menu=projMenu)
# Load in existing files
loadMenu = Menu(menubar, tearoff=0)
loadMenu.add_command(label="Load Theme - Client", command=lambda: loadTheme(parent, "Client", loadT1))
loadMenu.add_command(label="Load Theme - Counselor", command=lambda: loadTheme(parent, "Counselor", loadT2))
loadMenu.add_command(label="Load Workbook", command=lambda: loadExcel(parent, loadW))
loadMenu.add_command(label="Load Video File", command=lambda: vidLoad(parent, loadV))
menubar.add_cascade(label="Load Files", menu=loadMenu)
# Create new files
newMenu = Menu(menubar, tearoff=0)
newMenu.add_command(label="Create New Theme", command=lambda: importTheme(parent))
newMenu.add_command(label="Create New Workbook", command=lambda: createExcel(parent))
menubar.add_cascade(label="Create Files", menu=newMenu)
# Show the User which Files are loaded
self.load1 = Label(self.parent, textvariable=loadT1).pack()
self.load2 = Label(self.parent, textvariable=loadT2).pack()
self.load3 = Label(self.parent, textvariable=loadW).pack()
self.load4 = Label(self.parent, textvariable=loadV).pack()
# The second panel holds controls
self.player = None
self.videopanel = ttk.Frame(self.parent)
self.canvas = Canvas(self.videopanel).pack(fill=BOTH, expand=1)
self.videopanel.pack(fill=BOTH, expand=1)
#Building the control panel
ctrlpanel = ttk.Frame(self.parent)
l = Label(ctrlpanel, text=" ")
pause = ttk.Button(ctrlpanel, text="Pause", command=self.OnPause)
play = ttk.Button(ctrlpanel, text="Play", command=self.OnPlay)
stop = ttk.Button(ctrlpanel, text="Stop", command=self.OnStop)
volume = ttk.Button(ctrlpanel, text="Mute", command=self.OnToggleVolume)
pause.pack(side=LEFT)
play.pack(side=LEFT)
stop.pack(side=LEFT)
l.pack(side=LEFT)
volume.pack(side=LEFT)
#Building volume slider
self.volume_var = IntVar()
self.volume_var.set(100)
frame1 = ttk.Frame(ctrlpanel)
self.volslider = Scale(frame1, variable=self.volume_var, command=self.volume_sel,
from_=0, to=100, orient=HORIZONTAL, length=100)
self.volslider.pack()
self.vol = Label(frame1, text='Volume').pack()
frame1.pack()
ctrlpanel.pack(side=BOTTOM)
l1 = Label(self.parent, text="")
l1.pack(side=BOTTOM)
#Building progress bar
ctrlpanel2 = ttk.Frame(self.parent)
self.scale_var = DoubleVar()
self.timeslider_last_val = ""
self.timeslider = Scale(ctrlpanel2, variable=self.scale_var, command=self.scale_sel,
from_=0, to=10000, orient=HORIZONTAL, length=500, tickinterval=60)
self.timeslider.pack(side=BOTTOM, fill=X, expand=1)
self.timeslider_last_update = time.time()
ctrlpanel2.pack(side=BOTTOM, fill=X)
# VLC player controls
self.Instance = vlc.Instance()
self.player = self.Instance.media_player_new()
self.timer = ttkTimer(self.OnTimer, 1.0)
self.timer.start()
self.parent.update()
# self.player.set_hwnd(self.GetHandle()) # for windows, OnOpen does does this
def OnExit(self, evt):
"""Closes the window.
"""
self.Close()
def OnOpen(self):
"""Pop up a new dialow window to choose a file, then play the selected file.
"""
# If a file is already running, then stop it.
self.OnStop()
# Setting the media to the vidFile from the project
self.Media = self.Instance.media_new(vidFile)
self.player.set_media(self.Media)
# Set the window id where to render VLC's video output
if platform.system() == 'Windows':
self.player.set_hwnd(self.GetHandle())
else:
self.player.set_xwindow(self.GetHandle()) # this line messes up windows
self.OnPlay()
self.volslider.set(100)
def OnPlay(self):
"""Toggle the status to Play/Pause.
If no file is loaded, open the dialog window.
"""
# check if there is a file to play, otherwise open a
# Tk.FileDialog to select a file
if not self.player.get_media():
self.OnOpen()
else:
# Try to launch the media, if this fails display an error message
if self.player.play() == -1:
self.errorDialog("Unable to play.")
def GetHandle(self):
return self.videopanel.winfo_id()
# def OnPause(self, evt):
def OnPause(self):
"""Pause the player.
"""
self.player.pause()
def OnStop(self):
"""Stop the player.
"""
self.player.stop()
# reset the time slider
self.timeslider.set(0)
def OnTimer(self):
"""Update the time slider according to the current movie time.
"""
if self.player == None:
return
# since the self.player.get_length can change while playing,
# re-set the timeslider to the correct range.
length = self.player.get_length()
dbl = length * 0.001
self.timeslider.config(to=dbl)
# update the time on the slider
tyme = self.player.get_time()
if tyme == -1:
tyme = 0
dbl = tyme * 0.001
self.timeslider_last_val = ("%.0f" % dbl) + ".0"
# don't want to programatically change slider while user is messing with it.
# wait 2 seconds after user lets go of slider
if time.time() > (self.timeslider_last_update + 2.0):
self.timeslider.set(dbl)
def scale_sel(self, evt):
if self.player == None:
return
nval = self.scale_var.get()
sval = str(nval)
if self.timeslider_last_val != sval:
self.timeslider_last_update = time.time()
mval = "%.0f" % (nval * 1000)
self.player.set_time(int(mval)) # expects milliseconds
def volume_sel(self, evt):
if self.player == None:
return
volume = self.volume_var.get()
if volume > 100:
volume = 100
if self.player.audio_set_volume(volume) == -1:
self.errorDialog("Failed to set volume")
def OnToggleVolume(self):
"""Mute/Unmute according to the audio button.
"""
is_mute = self.player.audio_get_mute()
self.player.audio_set_mute(not is_mute)
# update the volume slider;
# since vlc volume range is in [0, 200],
# and our volume slider has range [0, 100], just divide by 2.
self.volume_var.set(self.player.audio_get_volume())
def OnSetVolume(self):
"""Set the volume according to the volume sider.
"""
volume = self.volume_var.get()
# vlc.MediaPlayer.audio_set_volume returns 0 if success, -1 otherwise
if volume > 100:
volume = 100
if self.player.audio_set_volume(volume) == -1:
self.errorDialog("Failed to set volume")
def errorDialog(self, errormessage):
"""Display a simple error dialog"""
Tk.tkMessageBox.showerror(self, 'Error', errormessage)
def get_time(self):
return self.player.get_time()
# Button class, contains data and write to excel functionality
class but:
def __init__ (self, key, name, type, master, player, observed):
self.key = key
self.name = name
self.type = type
self.active = 0
self.time = ""
self.time2 = ""
self.time3 = 0
self.time4 = 0
self.player = player
self.observed = observed
global gridi
global gridj
global excelFile
# print(self.type)
if self.type == "1":
b = Button(
master, text=key, command=lambda: self.createEntry(excelFile, self.time, self.time),
height=2, width=4
)
else:
b = Checkbutton(
master, text=key, command=lambda: self.createEntry(excelFile, self.time, self.time),
height=2, width=4, indicatoron=0
)
b.grid(row=gridi, column=(gridj % 10))
# print(gridi)
gridj += 1
if (gridj % 10) == 0:
gridi += 1
def createEntry(self, file, time, time2):
if self.type == "1":
wb = load_workbook(file)
ws = wb.active
index = ws.max_row + 1
ws.cell(row=index, column=1).value = self.observed
ws.cell(row=index, column=2).value = self.key
ws.cell(row=index, column=3).value = self.name
ws.cell(row=index, column=4).value = getTime(self.player, 1)
ws.cell(row=index, column=5).value = ""
ws.cell(row=index, column=6).value = getTime(self.player, 2)
ws.cell(row=index, column=7).value = ""
wb.save(file)
else:
if self.active == 0:
self.time = getTime(self.player, 1)
self.time3 = getTime(self.player, 2)
self.active = 1
else:
self.time2 = getTime(self.player, 1)
self.time4 = getTime(self.player, 2)
self.active = 0
wb = load_workbook(file)
ws = wb.active
index = ws.max_row + 1
ws.cell(row=index, column=1).value = self.observed
ws.cell(row=index, column=2).value = self.key
ws.cell(row=index, column=3).value = self.name
ws.cell(row=index, column=4).value = self.time
ws.cell(row=index, column=5).value = self.time2
ws.cell(row=index, column=6).value = self.time3
ws.cell(row=index, column=7).value = self.time4
ws.cell(row=index, column=8).value = (self.time4 - self.time3)
wb.save(file)
# Creates the buttons used by the TIE Coder
class themeBut:
def __init__ (self, key, name, type, master):
self.key = key
self.name = name
self.type = type
self.used = 0
global gridi
global gridj
b = Checkbutton(
master, text=key, command=lambda: self.change(),
height=2, width=4, indicatoron=0
)
b.grid(row=gridi, column=(gridj % 10))
gridj += 1
if (gridj % 10) == 0:
gridi += 1
def change(self):
if self.used == 0:
self.used = 1
else:
self.used = 0
def getUsed(self):
return self.used
# Used to get different time points in the playuer
def getTime(player, type):
time = player.get_time()
t = int(time / 1000)
min = int(t / 60)
if min < 10:
mins = "0" + str(min)
else:
mins = str(min)
sec = int(t % 60)
if sec < 10:
secs = "0" + str(sec)
else:
secs = str(sec)
# print(min + " " + sec)
timeStr = "" + mins + ":" + secs
if type == 1:
return timeStr
else:
return t
def Tk_get_root():
if not hasattr(Tk_get_root, "root"): # (1)
Tk_get_root.root = Tk() # initialization call is inside the function
return Tk_get_root.root
# Basic quit function
def _quit():
# print("_quit: bye")
root = Tk_get_root()
root.quit() # stops mainloop
root.destroy() # this is necessary on Windows to prevent
# Fatal Python Error: PyEval_RestoreThread: NULL tstate
os._exit(1)
def saveQuit(master):
global themeFile
global themeFile2
global excelFile
global vidFile
newRes = themeFile + ";" + themeFile2 + ";" + excelFile + ";" + vidFile
file = open("./Resources/resumeFile.txt", 'w')
file.write(newRes)
_quit()
def resume(master, file1, file2, file3, file4):
global themeFile
global themeFile2
global excelFile
global vidFile
projFile = "./Resources/resumeFile.txt"
with open("./Resources/resumeFile.txt", "rU") as FILE:
for line in FILE:
line = line.strip()
themeFile = line.split(";")[0]
themeFile2 = line.split(";")[1]
excelFile = line.split(";")[2]
vidFile = line.split(";")[3]
trim = os.path.basename(themeFile)
file1.set("Client Theme: " + trim)
trim = os.path.basename(themeFile2)
file2.set("Counsellor Theme: " + trim)
trim = os.path.basename(excelFile)
file3.set("Workbook: " + trim)
trim = os.path.basename(vidFile)
file4.set("Video File: " + trim)
# Read a project file and load sub-files into memory
def loadProj(master, file1, file2, file3, file4):
projFile = askopenfilename(initialdir="./Projects", title="Select a Project")
global themeFile
global themeFile2
global excelFile
global vidFile
with open(projFile, "rU") as FILE:
for line in FILE:
line = line.strip()
themeFile = line.split(";")[0]
themeFile2 = line.split(";")[1]
excelFile = line.split(";")[2]
vidFile = line.split(";")[3]
trim = os.path.basename(themeFile)
file1.set("Client Theme: " + trim)
trim = os.path.basename(themeFile2)
file2.set("Counsellor Theme: " + trim)
trim = os.path.basename(excelFile)
file3.set("Workbook: " + trim)
trim = os.path.basename(vidFile)
file4.set("Video File: " + trim)
# Query user for project name and pass name to projSave
def saveProj(master):
pop = Tk()
pop.title("Create a new Project File")
frame = Frame(pop, height=225, width=300)
frame.pack_propagate(0)
frame.pack()
l = Label(frame, text="To save a new project, make sure you have loaded:\n \n A Client Theme \n A Counsellor Theme \n A Workbook\n A Video File. \n \n Project File Name \n")
l.pack()
# Entry Window
e = Entry(frame)
e.pack()
e.focus_set()
l2 = Label(frame, text="")
l2.pack()
# Submission Button takes contents of Entry Window and calls newExcel on it
b = ttk.Button(frame, text="Create Project", command=lambda: projSave("" + e.get(), pop))
b.pack()
# Save currently loaded files into project file based on input for later.
def projSave(input, pop):
global themeFile
global themeFile2
global excelFile
global vidFile
filename = "./Projects/" + input + ".txt"
file = open(filename, "w")
file.write(themeFile + ";" + themeFile2 + ";" + excelFile + ";" + vidFile)
pop.destroy()
# Tkinter interface for TIE Coder -- THIS NEEDS TO BE RENAMED
def playerInterface(player, observed):
pop = Tk()
pop.title("SweetTie Coder 1.3 - " + observed)
global themeFile
global themeFile2
theme = {}
if observed == "Client":
theme = themeRead(themeFile)
else:
theme = themeRead(themeFile2)
frame = Frame(pop)
frame.pack_propagate(0)
frame.pack()
#frame.pack()
# Setting up button Widgets for container for GUI
for (key, items) in sorted(theme.iteritems(), key=lambda (x, y):float(x)):
but(items[0], items[1], items[2], frame, player, observed)
# Reads a theme file and parses it into a dictionary
# to be used to construct the buttons
def themeLine(line, theme):
line = line.strip()
theme[line.split(",")[0]] = [line.split(",")[1]]
theme[line.split(",")[0]].append(line.split(",")[2])
theme[line.split(",")[0]].append(line.split(",")[3])
return theme
# Parses the Theme's file into lines to be passed to themeLine for dictionary writing
def themeRead(file):
theme = {}
with open(file, "rU") as FILE:
for line in FILE:
themeLine(line, theme)
return theme
# Loads themes into memory for Client/Counsellor
def loadTheme(master, observed, file):
# Querying user for theme.txt file
global themeFile
global themeFile2
if observed == "Client":
themeFile = tkFileDialog.askopenfilename(initialdir="./Themes", title="Select a Theme for the Client")
trim = os.path.basename(themeFile)
file.set("Client Theme: " + trim)
else:
themeFile2 = tkFileDialog.askopenfilename(initialdir="./Themes", title="Select a Theme for the Counsellor")
trim = os.path.basename(themeFile)
file.set("Counsellor Theme: " + trim)
# Uses Master List to generate new custom themes
def importTheme(master):
global themeBuild
themeBuildFile = "./Resources/Theme Master List.txt"
themeBuild = themeRead(themeBuildFile)
buildTheme()
# Builds the themeBuild dictionary to be used by newTheme
def buildTheme():
global themeBuild
global gridi
global gridj
global buttonDict
gridi = 0
gridj = 0
# Setting up button container Widget for GUI
pop1 = Tk()
pop1.title("Creating New Theme")
l = Label(pop1, text="\n Pick Existing Behaviors You'd like to Use \n")
l.pack()
frame = Frame(pop1, height=450, width=450)
frame.pack_propagate(0)
frame.pack()
# Setting up button Widgets for container for GUI
for (key, items) in sorted(themeBuild.iteritems(), key=lambda (x, y):float(x)):
buttonDict[key] = themeBut(items[0], items[1], items[2], frame)
l1 = Label(pop1, text="\n Please Name Your New Theme \n")
l1.pack()
e = Entry(pop1)
e.pack()
e.focus_set()
l2 = Label(pop1, text=" ")
l2.pack()
b1 = ttk.Button(pop1, text="Finish", command=lambda: newTheme(e.get(), pop1))
b1.pack()
# Writes the themeBuild theme into a new Theme file
def newTheme(input, pop3):
global themeBuild
global buttonDict
for (key, but) in buttonDict.items():
if but.getUsed() == 0:
del themeBuild[key]
filename = "./Themes/" + input + ".txt"
file = open(filename, "w")
for (key, items) in themeBuild.items():
line = "" + key + "," + items[0] + "," + items[1] + "," + items[2] + "\n"
file.write(line)
pop3.destroy()
# Loads a given workbook into memory
def loadExcel(master, file):
global excelFile
excelFile = tkFileDialog.askopenfilename(initialdir="./Workbooks", title="Select a Workbook")
trim = os.path.basename(excelFile)
file.set("Workbook: " + trim)
# Creates newExcel string for the init function
def newExcel(input, pop):
# Generating Blank Workbook
wb = Workbook()
global excelFile
excelFile = "./Workbooks/" + input + ".xlsx"
# Creating new Excel File
wb.save(excelFile)
# Initializing new Excel File
init(excelFile)
pop.destroy()
# Confirmation of File Creation
# Takes user input and passes to newExcel to make a new workbook based on input
def createExcel(master):
global excelFile
# Generating new Pop-Up Window
pop = Tk()
pop.title("Create a Workbook File")
frame = Frame(pop, height=100, width=300)
frame.pack_propagate(0)
frame.pack()
# Labelling intended content of the Entry Window
l = Label(frame, text="New File Name")
l.pack()
# Entry Window
e = Entry(frame)
e.pack()
e.focus_set()
l1 = Label(frame, text="")
l1.pack()
# Submission Button takes contents of Entry Window and calls newExcel on it
b = Button(frame, text="Create Workbook", width=15, command=lambda: newExcel(e.get(), pop))
b.pack()
# Initializes a new Workbook and Writes in coloumn headers. SHould prob rename this.
def init(file):
wb = load_workbook(file)
ws = wb.active
ws.cell(row=2, column=1).value = "Observed"
ws.column_dimensions["A"].width = 20
ws.cell(row=2, column=2).value = "ID"
ws.column_dimensions["B"].width = 8
ws.cell(row=2, column=3).value = "Behavior Name"
ws.column_dimensions["C"].width = 40
ws.cell(row=2, column=4).value = "Time of Onset"
ws.column_dimensions["D"].width = 15
ws.cell(row=2, column=5).value = "Time of Offset"
ws.column_dimensions["E"].width = 15
ws.cell(row=2, column=6).value = "Onset in Secs"
ws.column_dimensions["F"].width = 15
ws.cell(row=2, column=7).value = "Offset in Secs"
ws.column_dimensions["G"].width = 15
ws.cell(row=2, column=8).value = "Duration in Secs"
ws.column_dimensions["H"].width = 15
wb.save(file)
# Creates the vidFile string for the player
def vidLoad(master, file):
global vidFile
# p = pathlib.Path(os.path.expanduser("~"))
vidFile = askopenfilename(initialdir="./Video Files", title="Choose a Video File", filetypes=(("all files", "*.*"), ("mp4 files", "*.mp4")))
trim = os.path.basename(vidFile)
file.set("Video File: " + trim)
if __name__ == "__main__":
# Create a Tk.App(), which handles the windowing system event loop
root = Tk_get_root()
# Setting consistent style
style = ttk.Style()
style.theme_use('xpnative')
# Building main player window
root.iconbitmap(default='./Resources/Tie.ico')
root.protocol("WM_DELETE_WINDOW", _quit)
player = Player(root, title="TIE Suite 1.3")
# show the player window centered and run the application
root.mainloop()