-
Notifications
You must be signed in to change notification settings - Fork 1
/
CheckVocal.pyw
2738 lines (2515 loc) · 131 KB
/
CheckVocal.pyw
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
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#
# CheckVocal.pyw v.3.0.2
# Athanassios Protopapas
# 2 June 2020 (fixed NO_RESPONSE in text-entry mode)
#
# This program will help with naming task data from DMDX
# It will present each recorded vocal response along with
# the correct response and will adjust RT to indicate correct,
# wrong, or timed-out response, as indicated by the user.
# (A text file with the correct response for each trial is needed.)
# The user can also check and fix improperly triggered RT measurements.
# The results are saved in a tab-separated file, one row per subject.
#
VERSION = "3.0.2.0"
EMAIL = "protopap@gmail.com"
import sys
if (sys.platform == "win32"):
_WINDOWS_ = True
_MAC_ = False
elif (sys.platform == "darwin"):
_WINDOWS_ = False
_MAC_ = True
else:
_WINDOWS_ = False
_MAC_ = False
import os
import string
import math
import datetime
import time
import operator
import codecs
import copy
import functools
import inspect
if _WINDOWS_:
import _winreg
elif _MAC_:
import plistlib
from Tkinter import *
from tkSnack import *
import tkFileDialog, tkMessageBox, tkSimpleDialog
import tkFont
import re
## FIXED PARAMETERS set in GlobVariables
DEFAULT_C_DIST = 10 # pixels for vertical panel separation
DEFAULT_SUBJ_COL = 30 # subjects per column in subject selection frame
DEFAULT_ONE_COL_MAX = 20 # maximum number of subjects in a single column
DEFAULT_SUBJ_MAX = 180 # above this number, only subject IDs are shown for selection
DEFAULT_DETRIGGER = 0.5 # proportion of RT trigger RMS value signaling silence
DEFAULT_CLASSMULT = 1000000 # number to multiply with class to be added to RT in classification mode
## PARAMETERS ADJUSTED IN OPENING WINDOW
##
DEFAULT_ENCODING = "Latin (ISO-8859-1)" # Encoding for answer string display
DEFAULT_RMS = 45 # RMS threshold for VoX triggering, in dB
DEFAULT_WINDOWMS = 10 # window for calculation of RMS energy, in ms
DEFAULT_TRIGGER = 0 # use RT marks from DMDX VoX
DEFAULT_REVERSETRIGGER = False # trigger response onset (from the beginning of the file)
DEFAULT_TIMEOUT = 10000 # default value for the manually set timeout GUI
DEFAULT_TIMEOUTSRC = 0 # use timeout value from .rtf item file
DEFAULT_BLINK = 0 # no blink of answer string
DEFAULT_CANVASWIDTH = 800 # pixels of wave & spectrogram width
DEFAULT_CANVASHEIGHT = 150 # pixels of wave & spectrogram height
DEFAULT_SAVEFMT = 1 # save output in one row per subject
DEFAULT_REMOVEDC = False # do not filter the sounds to remove DC offset
DEFAULT_REMOVEDUPLICATEITEMS = False # remove repeated items (adjacent trials only!) # ThP May 2014
DEFAULT_ENTERSTRING = False # user-supplied string instead of correct/wrong # ThP April 2019
DEFAULT_DOCLASSIFY = False # classification into N groups instead of correct/wrong # ThP May 2019
DEFAULT_NCLASSES = 3 # classification into N groups instead of correct/wrong # ThP May 2019
DEFAULT_MODECHOICE = 1 # default correct/wrong classification
DEFAULT_SEP = 0 # separator for output data file defaults to Tab (1=space, 2=comma)
DEFAULT_SAVEDATE = 1 # optionally save date/time/PC info along with output data
DEFAULT_SAVETIME = 1
DEFAULT_SAVECOMPUTER = 0
DEFAULT_SAVEREFRESH = 0
DEFAULT_SAVETRIALORDER = 0
## BASE FONTS
DEFAULT_SCALE = 9 # main font size under Windows, used as a scaling factor
DEFAULT_FONTFAMILY = "Helvetica"
if _WINDOWS_:
DEFAULT_FONTSIZE = 9
elif _MAC_:
DEFAULT_FONTSIZE = 12
else:
DEFAULT_FONTSIZE = 9
## MICSELLANEOUS PARAMETERS
##
DMDXMODE = True # True when processing azk files; False when processing arbitrary audio file sets
UBPATH = '~/Library/Application Support'
APPNAME = "CheckVocal"
FILES_EXPNAME = "CheckVocal_AudioFiles"
PLISTFNAME = "param.plist"
DEFAULT_WAVEXT = u".WAV" # apparently, DMDX saves with uppercase extension and the Mac doesn't like that
FILES_WAVEXTS = [DEFAULT_WAVEXT, DEFAULT_WAVEXT.lower()]
CV_REGISTRY_KEY = "SOFTWARE\\CheckVocal\\" # location of last folder key
PRINT_ENCODING = "iso-8859-1" # for printing messages on console window
ENCODING_OPTIONS = ["Latin (ISO-8859-1)",
"European (ISO-8859-2)",
"Esperanto (ISO-8859-3)",
"Baltic (ISO-8859-4)",
"Cyrillic (ISO-8859-5)",
"Arabic (ISO-8859-6)",
"Greek (ISO-8859-7)",
"Hebrew (ISO-8859-8)",
"Turkish (ISO-8859-9)",
"Chinese (EUC-CN)",
"Chinese (GB2312)",
"Japanese (EUC-JP)",
"Korean (EUC-KR)"]
_NO_SOUND_FLAG_ = u"*!*" # the "code" string in -ans to skip a response (lacking an audio file)
# Variables and settings that need to be available to various widgets and processes
#
class GlobVariables:
def __init__(self):
self.encoding = StringVar(root)
self.w_canvas = StringVar(root)
self.h_canvas = StringVar(root)
self.rmstxt = StringVar(root)
self.wdutxt = StringVar(root)
self.trigchoice = IntVar(root)
self.reversetriggerchoice = IntVar(root)
self.removeDCchoice = IntVar(root)
self.remove_duplicates = IntVar(root) # ThP May 2014
self.enterstring = IntVar(root) # ThP April 2019
self.userstring = StringVar(root) # ThP April 2019
self.doclassify = IntVar(root) # ThP May 2019
self.modechoice = IntVar(root) # ThP May 2019
self.nclasses = StringVar(root) # ThP May 2019
self.savechoice = IntVar(root)
self.timetxt = StringVar(root)
self.timechoice = IntVar(root)
self.blnkchoice = IntVar(root)
self.sepchoice = IntVar(root)
self.azkff = StringVar(root)
#
self.savedate = IntVar(root)
self.savetime = IntVar(root)
self.savecomputer = IntVar(root)
self.saverefresh = IntVar(root)
self.savetrialorder = IntVar(root)
#
self.azkfilename = ""
self.expdir = "."
self.expname = ""
self.logfile = ""
self.Nsubj = 0
self.sub_trials = {}
self.sub_order = {}
self.done = 0
self.SRATE = 0
self.totaltrials = 0
self.trial_ind = {}
self.subj_ind = {}
self.sub_origlines = {}
self.sub_ids = {}
self.sub_dates = {}
self.sub_refresh = {}
self.sub_nums = {}
self.dmdxtimeout = -1
self.char_encoding = PRINT_ENCODING
self._COT_ = 0
#
self.tmplistofanswers = [] # ThP Oct 2014
self.listofanswers = [] # content & usage changed in v.2.2.7; now fully aligned with listoftrials # ThP Oct 2014
self.listoftrials = []
self.listoffiles = []
self.listoftrialsub = []
self.listofproblems = []
self.listofloaded = []
self.original_listoftrials = []
#
## Fixed parameters
self._SEP = DEFAULT_SEP
self._C_DIST = DEFAULT_C_DIST
self._SUBJ_COL = DEFAULT_SUBJ_COL
self._ONE_COL_MAX = DEFAULT_ONE_COL_MAX
self._SUBJ_MAX = DEFAULT_SUBJ_MAX
self._DETRIGGER = DEFAULT_DETRIGGER
self._CLASSMULT = DEFAULT_CLASSMULT
#
## Fonts
self.fontfamily = DEFAULT_FONTFAMILY
self.fontsize = DEFAULT_FONTSIZE
self.largefontsize = DEFAULT_FONTSIZE * 10 / 9
self.verylargefontsize = DEFAULT_FONTSIZE * 14 / 9
self.mainfont = tkFont.Font(family=self.fontfamily, size=self.fontsize, weight=tkFont.NORMAL,slant=tkFont.ROMAN)
self.mainboldfont = tkFont.Font(family=self.fontfamily, size=self.fontsize, weight=tkFont.BOLD,slant=tkFont.ROMAN)
self.largefont = tkFont.Font(family=self.fontfamily, size=self.largefontsize, weight=tkFont.NORMAL,slant=tkFont.ROMAN)
self.largeboldfont = tkFont.Font(family=self.fontfamily, size=self.largefontsize, weight=tkFont.BOLD,slant=tkFont.ROMAN)
self.verylargefont = tkFont.Font(family=self.fontfamily, size=self.verylargefontsize, weight=tkFont.NORMAL,slant=tkFont.ROMAN)
self.verylargeboldfont = tkFont.Font(family=self.fontfamily, size=self.verylargefontsize, weight=tkFont.BOLD,slant=tkFont.ROMAN)
#
def scale(self, w):
return w * DEFAULT_FONTSIZE / DEFAULT_SCALE
def update(self):
if (self.timechoice.get() == 0):
self.timeout = self.dmdxtimeout # get from DMDX
else:
self.timeout = string.atoi(self.timetxt.get())
tmp_enc = self.encoding.get().split()[-1]
self.char_encoding = tmp_enc.strip('()')
##
self._BLINK = self.blnkchoice.get()
self._RETRIGGER = self.trigchoice.get()
self._REVERSETRIGGER = self.reversetriggerchoice.get()
self._REMOVEDC = self.removeDCchoice.get()
self._REMOVEDUPLICATES = self.remove_duplicates.get() # ThP May 2014
self._ENTERSTRING = self.enterstring.get() # ThP April 2019
self._DOCLASSIFY = self.doclassify.get() # ThP May 2019
self._NCLASSES = string.atoi(self.nclasses.get()) # ThP May 2019
self._RMSDUR = string.atof(self.wdutxt.get())
self._RMSLIM = string.atof(self.rmstxt.get())
self._C_WIDTH = string.atoi(self.w_canvas.get())
self._C_HEIGHT = string.atoi(self.h_canvas.get())
self.save_rows = self.savechoice.get()
if (self.sepchoice.get() == 0):
self._SEP = "\t"
elif (self.sepchoice.get() == 1):
self._SEP = " "
elif (self.sepchoice.get() == 2):
self._SEP = ","
def reset(self):
self.encoding.set(DEFAULT_ENCODING)
self.w_canvas.set(`DEFAULT_CANVASWIDTH`)
self.h_canvas.set(`DEFAULT_CANVASHEIGHT`)
self.rmstxt.set(`DEFAULT_RMS`)
self.wdutxt.set(`DEFAULT_WINDOWMS`)
self.trigchoice.set(DEFAULT_TRIGGER)
self.reversetriggerchoice.set(DEFAULT_REVERSETRIGGER)
self.removeDCchoice.set(DEFAULT_REMOVEDC)
self.remove_duplicates.set(DEFAULT_REMOVEDUPLICATEITEMS) # ThP May 2014
self.enterstring.set(DEFAULT_ENTERSTRING) # ThP April 2019
self.userstring.set("") # ThP April 2019
self.doclassify.set(DEFAULT_DOCLASSIFY) # ThP May 2019
self.modechoice.set(DEFAULT_MODECHOICE) # ThP May 2019
self.nclasses.set(DEFAULT_NCLASSES) # ThP May 2019
self.savechoice.set(DEFAULT_SAVEFMT)
self.sepchoice.set(DEFAULT_SEP)
self.timetxt.set(`DEFAULT_TIMEOUT`)
self.timeout = DEFAULT_TIMEOUT
self.timechoice.set(DEFAULT_TIMEOUTSRC)
self.blnkchoice.set(DEFAULT_BLINK)
#
self.savedate.set(DEFAULT_SAVEDATE)
self.savetime.set(DEFAULT_SAVETIME)
self.savecomputer.set(DEFAULT_SAVECOMPUTER)
self.saverefresh.set(DEFAULT_SAVEREFRESH)
self.savetrialorder.set(DEFAULT_SAVETRIALORDER)
#
self.azkff.set("")
self.read_lastfolder()
def read_lastfolder(self): # Read the last selected folder from the registry if possible
if not (_WINDOWS_ or _MAC_):
self.lastfolder = "."
# we may add here something to keep track of things in a file...
return
if _MAC_:
basepath = os.path.expanduser(UBPATH)
cvpath = os.path.join(basepath, APPNAME)
try:
pl = plistlib.readPlist(os.path.join(cvpath, PLISTFNAME))
except IOError: # nonexistent file
self.lastfolder = "."
else:
self.lastfolder = pl["lastfolder"]
if (not os.path.exists(self.lastfolder)): # path not available (deleted, on removable media..)
self.lastfolder = "."
return
try: # WINDOWS #
rkey = _winreg.CreateKey(_winreg.HKEY_CURRENT_USER,CV_REGISTRY_KEY)
self.lastfolder = _winreg.QueryValueEx(rkey, "LastFolder")[0]
_winreg.CloseKey(rkey)
except WindowsError: # nonexistent key or error reading registry
self.lastfolder = "" # an empty string to return false from os.path.exists()
if (not os.path.exists(self.lastfolder)): # path not available (deleted, on removable media..)
try: # retrieve user "home" from the registry
dkey = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, "Volatile Environment\\")
homedrive = _winreg.QueryValueEx(dkey, "HOMEDRIVE")[0]
homepath = _winreg.QueryValueEx(dkey, "HOMEPATH")[0]
_winreg.CloseKey(dkey)
self.lastfolder = homedrive + homepath
except WindowsError: # nonexistent key or error reading registry
self.lastfolder = "."
# General message display, both on screen ("console" window) and log file
#
def logmsg(logtext):
# added encoding to deal with printing out non-ascii path components
try:
gv.logfile.write(logtext.encode(gv.char_encoding, 'replace') + "\n")
gv.logfile.flush()
except:
pass # in case logfile isn't working yet
msgwindow.display(logtext + "\n")
# Fatal program failure, logging and displaying message before exiting
#
def exiterror(errtext):
logmsg("**ERROR: " + errtext)
tkMessageBox.showerror("CheckVocal error", errtext)
global_quit()
# Deal with non-terminated text files by adding a final newline
#
def myreadlines(f):
rlines = f.readlines()
if (len(rlines) < 1):
exiterror("Empty file %s" % (f.name))
if (rlines[-1][-1] != "\n"):
last = rlines[-1] + "\n"
rlines = rlines[:-1]
rlines.append(last)
return rlines
# Subclassing of tkSimpleDialog for the continuation prompt window
# Based on code from Chapter 10 of 'An Introduction to Tkinter' by F. Lundh
# http://www.pythonware.com/library/tkinter/introduction/dialog-windows.htm
#
class ContDialog(tkSimpleDialog.Dialog):
def __init__(self, parent, title=None, p_time="UNKNOWN"):
Toplevel.__init__(self, parent)
self.transient(parent) # OK to be transient, parent is msgwindow
if (IconFile != "None"): self.wm_iconbitmap(IconFile)
if title:
self.title(title)
self.parent = parent
self.result = None
body = Frame(self)
self.initial_focus = self.body(body, p_time)
body.pack(padx=gv.scale(5), pady=gv.scale(5))
self.buttonbox()
self.grab_set()
if not self.initial_focus:
self.initial_focus = self
self.protocol("WM_DELETE_WINDOW", self.cancel)
self.geometry("+%d+%d" % (gv.scale(200), gv.scale(200)))
self.initial_focus.focus_set()
self.wait_window(self)
def contin(self, event=None):
self.result = 1
if not self.validate():
self.initial_focus.focus_set() # put focus back
return
self.withdraw()
self.update_idletasks()
self.cancel()
def stnew(self):
self.result = 0
if not self.validate():
self.initial_focus.focus_set() # put focus back
return
self.withdraw()
self.update_idletasks()
self.cancel()
def quitall(self):
self.result = -1
self.parent.focus_set()
self.destroy()
def body(self, master, p_time):
Label(master, text="An unfinished session was found", font=gv.mainfont).pack(side="top")
Label(master, text="last modified on " + p_time, font=gv.mainfont).pack(side="top")
def buttonbox(self):
buttonframe = Frame(self)
w = Button(buttonframe, text="Continue", font=gv.mainfont, width=10, command=self.contin, default=ACTIVE).pack(side=LEFT, padx=gv.scale(5), pady=gv.scale(5))
w = Button(buttonframe, text="Start new", font=gv.mainfont, width=10, command=self.stnew).pack(side=LEFT,padx=gv.scale(5),pady=gv.scale(5))
w = Button(buttonframe, text="Quit", font=gv.mainfont, width=10, command=self.quitall).pack(side=LEFT,padx=gv.scale(5),pady=gv.scale(5))
self.bind("<Return>", self.ok)
self.bind("<Escape>", self.cancel)
buttonframe.pack(pady=gv.scale(10))
def apply(self):
pass
# The message 'console' window, with a display method to add text lines
#
class TextWindow(Toplevel):
def __init__(self, parent):
Toplevel.__init__(self, parent)
self.geometry("+%d+%d" % (gv.scale(100), gv.scale(480)))
if (IconFile != "None"): self.wm_iconbitmap(IconFile)
def body(self):
self.textscrollbar = Scrollbar(self)
self.textscrollbar.pack(side=RIGHT, fill=Y)
self.title("CheckVocal messages")
self.textbox = Text(self)
self.textbox.config(width=80, height=15)
self.textbox.config(background="White", foreground="Black", font=("Courier", gv.scale(10)))
self.textbox.config(wrap=CHAR, state=DISABLED, yscrollcommand=self.textscrollbar.set)
self.textbox.pack(side="top")
self.textscrollbar.config(command=self.textbox.yview)
return self.textbox
def display(self, text):
self.textbox.config(state=NORMAL)
self.textbox.insert(END, text)
self.textbox.see(END)
self.textbox.config(state=DISABLED)
self.update()
# The parameter setup/configure window
#
class SetupWindow(Toplevel):
def __init__(self, parent):
Toplevel.__init__(self, parent)
# self.transient(parent) # cannot be transient, parent is root (withdrawn)
self.parent = parent
self.filename_prompt = "DMDX results file:"
self.setup_window(u"CheckVocal setup")
def setup_window(self, windowtitle):
self.title(windowtitle)
self.geometry("+%d+%d" % (gv.scale(100), gv.scale(150)))
if (IconFile != "None"): self.wm_iconbitmap(IconFile)
self.initial_focus = self
self.initial_focus.focus_set()
self.grab_set()
self.protocol("WM_DELETE_WINDOW", self.mquit)
self.bind("<Return>", self.proceed)
self.bind("<Escape>", self.mquit)
#
self.status = -1
self.fileOK = BooleanVar()
self.fileOK.set(False)
self.fileOK.trace("w", self.mayproceed)
self.timeoutOK = BooleanVar()
self.timeoutOK.set(True)
self.timeoutOK.trace("w", self.mayproceed)
#
self.pack_actionbuttons_row()
self.pack_workmode_row()
self.pack_encoding_row()
self.pack_wavedisplay_row()
self.pack_voxtrigger_row()
self.pack_separator_row()
self.pack_datetime_row()
self.pack_dataformat_row()
self.pack_timeout_row()
self.pack_blink_row()
self.pack_filename_row()
# widgets
def pack_actionbuttons_row(self):
self.contF0 = Frame(self)
self.cbutton0 = Button(self.contF0, text="Proceed", command=self.proceed)
self.cbutton0.config(width=12, font=gv.mainboldfont, anchor="s")
self.cbutton0.pack(side="right", padx=gv.scale(24))
self.cbutton01 = Button(self.contF0, text="Reset", command=self.reset)
self.cbutton01.config(width=8, font=gv.mainfont, anchor="s")
self.cbutton01.pack(side="right", padx=gv.scale(5))
self.cbutton02 = Button(self.contF0, text="Cancel", command=self.mquit)
self.cbutton02.config(width=8, font=gv.mainfont, anchor="s")
self.cbutton02.pack(side="right", padx=gv.scale(5))
self.contF0.pack(side="bottom", pady=gv.scale(10))
def pack_workmode_row(self):
self.modF2a = Frame(self)
self.rlabel2a = Label(self.modF2a, text="Work mode:")
self.rlabel2a.config(width=20, font=gv.mainfont, anchor="e")
self.rlabel2a.pack(side="left")
self.modechoice2a = Radiobutton(self.modF2a, text="Correct/Wrong", variable=gv.modechoice, value=1, command=self.classifyoff)
self.modechoice2a.config(font=gv.mainfont)
self.modechoice2a.pack(side="left", anchor="s")
self.modechoice2b = Radiobutton(self.modF2a, text="Sort into", variable=gv.modechoice, value=2, command=self.classifyon)
self.modechoice2b.config(width=7, font=gv.mainfont)
self.modechoice2b.pack(side="left", anchor="s")
self.spinn2a = Spinbox(self.modF2a, values=(2, 3, 4, 5, 6))
self.spinn2a.config(width=1, font=gv.mainfont, textvariable=gv.nclasses, state="disabled")
self.spinn2a.pack(side="left")
self.rlabel2b = Label(self.modF2a, text="classes")
self.rlabel2b.config(width=8, font=gv.mainfont, anchor="w")
self.rlabel2b.pack(side="left")
self.modechoice2c = Radiobutton(self.modF2a, text="Enter number", variable=gv.modechoice, value=3, command=self.classifyoff)
self.modechoice2c.config(width=10, font=gv.mainfont)
self.modechoice2c.pack(side="left", anchor="s")
self.modF2a.pack(side="bottom", anchor="w")
def classifyon(self):
gv.enterstring.set(False)
self.activate_voxchoice()
gv.doclassify.set(True)
self.spinn2a.config(state="normal")
def classifyoff(self):
if (gv.modechoice.get() == 3):
gv.enterstring.set(True)
self.deactivate_voxchoice()
else:
gv.enterstring.set(False)
self.activate_voxchoice()
gv.doclassify.set(False)
self.spinn2a.config(state="disabled")
def deactivate_voxchoice(self):
self.trigchoice1.config(state="disabled")
self.trigchoice2.config(state="disabled")
self.filtdcC.config(state="disabled")
self.revtrigC.config(state="disabled")
self.rmslim31.config(state="disabled")
self.rmslim32.config(state="disabled")
def activate_voxchoice(self):
self.trigchoice1.config(state="normal")
self.trigchoice2.config(state="normal")
self.filtdcC.config(state="normal")
self.revtrigC.config(state="normal")
self.rmslim31.config(state="normal")
self.rmslim32.config(state="normal")
if (gv.trigchoice.get()==0): self.trigdmdx()
elif (gv.trigchoice.get()==1): self.trignew()
def pack_encoding_row(self):
self.encF2 = Frame(self)
self.rlabel2 = Label(self.encF2, text="Character encoding:")
self.rlabel2.config(width=20, font=gv.mainfont, anchor="e")
self.rlabel2.pack(side="left")
self.encodingmenu2 = apply(OptionMenu, (self.encF2, gv.encoding) + tuple(ENCODING_OPTIONS)) # from http://effbot.org/tkinterbook/optionmenu.htm
self.encodingmenu2.config(width=15, font=gv.mainfont)
self.encodingmenu2.pack(side="left")
#self.extraopt = Frame(self.encF2)
self.remdup = Checkbutton(self.encF2, text="Remove consecutive repeated items", variable=gv.remove_duplicates) #
self.remdup.config(font=gv.mainfont)
self.remdup.pack(side="left", anchor="s", padx=35)
#self.estring = Checkbutton(self.encF2, text="Enter user string instead of accuracy", variable=gv.enterstring) #
#self.estring.config(font=gv.mainfont)
#self.estring.pack(side="top", anchor="s")
#self.extraopt.pack(side="left", anchor="s", padx=35)
self.encF2.pack(side="bottom", anchor="w")
def pack_wavedisplay_row(self):
self.canvasF7 = Frame(self)
self.rlabel71 = Label(self.canvasF7, text="Wave display:")
self.rlabel71.config(width=20, font=gv.mainfont, anchor="e")
self.rlabel71.pack(side="left", anchor="e")
self.sdim71 = Spinbox(self.canvasF7, values=(200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200))
self.sdim71.config(width=4, font=gv.mainfont, textvariable=gv.w_canvas)
self.sdim71.pack(side="left")
self.rlabel72 = Label(self.canvasF7, text="pixels wide by")
self.rlabel72.config(width=12, font=gv.mainfont, anchor="w")
self.rlabel72.pack(side="left")
self.sdim72 = Spinbox(self.canvasF7, values=(100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200))
self.sdim72.config(width=4, font=gv.mainfont, textvariable=gv.h_canvas)
self.sdim72.pack(side="left")
self.rlabel73 = Label(self.canvasF7, text="pixels tall")
self.rlabel73.config(width=10, font=gv.mainfont, anchor="w")
self.rlabel73.pack(side="left")
self.canvasF7.pack(side="bottom", anchor="w", pady=gv.scale(5))
def pack_voxtrigger_row(self):
self.rmsF3 = Frame(self)
self.rlabel30 = Label(self.rmsF3, text=" ")
self.rlabel30.config(width=32, font=gv.mainfont, anchor="e")
self.rlabel30.pack(side="left", anchor="e")
self.rlabel31 = Label(self.rmsF3, text="RMS threshold:")
self.rlabel31.config(width=12, font=gv.mainfont, anchor="e")
self.rlabel31.pack(side="left", anchor="e")
self.rmslim31 = Spinbox(self.rmsF3, from_=1, to=90)
self.rmslim31.config(width=3, font=gv.mainfont, textvariable=gv.rmstxt)
self.rmslim31.pack(side="left")
self.rlabel32 = Label(self.rmsF3, text="dB")
self.rlabel32.config(width=2, font=gv.mainfont, anchor="w")
self.rlabel32.pack(side="left")
self.rlabel33 = Label(self.rmsF3, text="Window length: ")
self.rlabel33.config(width=14, font=gv.mainfont, anchor="e")
self.rlabel33.pack(side="left")
self.rmslim32 = Spinbox(self.rmsF3, from_=1, to=30)
self.rmslim32.config(width=3, font=gv.mainfont, textvariable=gv.wdutxt)
self.rmslim32.pack(side="left")
self.rlabel34 = Label(self.rmsF3, text="ms")
self.rlabel34.config(width=2, font=gv.mainfont, anchor="w")
self.rlabel34.pack(side="left")
self.rmsF3.pack(side="bottom", anchor="w")
self.trigF4 = Frame(self)
self.rlabel4 = Label(self.trigF4, text="RT marks from:")
self.rlabel4.config(width=20, anchor="e", font=gv.mainfont)
self.rlabel4.pack(side="left")
self.trigchoice1 = Radiobutton(self.trigF4, text="DMDX Vox", variable=gv.trigchoice, value=0, command=self.trigdmdx)
self.trigchoice1.config(font=gv.mainfont)
self.trigchoice1.pack(side="left", anchor="s")
self.trigchoice2 = Radiobutton(self.trigF4, text="CheckVocal", variable=gv.trigchoice, value=1, command=self.trignew)
self.trigchoice2.config(width=9, font=gv.mainfont)
self.trigchoice2.pack(side="left", anchor="s")
self.filtdcC = Checkbutton(self.trigF4, text="Remove DC", variable=gv.removeDCchoice)
self.filtdcC.config(font=gv.mainfont)
self.filtdcC.pack(side="left", anchor="s", padx=2)
self.revtrigC = Checkbutton(self.trigF4, text="Reverse (mark end)", variable=gv.reversetriggerchoice)
self.revtrigC.config(font=gv.mainfont)
self.revtrigC.pack(side="left", anchor="s", padx=2)
self.trigF4.pack(side="bottom", anchor="w", pady=1)
def pack_separator_row(self):
self.sepF9 = Frame(self)
self.rlabel9 = Label(self.sepF9, text="Value separator:")
self.rlabel9.config(width=20, anchor="e", font=gv.mainfont)
self.rlabel9.pack(side="left")
self.sepchoice1 = Radiobutton(self.sepF9, text="Tab", variable=gv.sepchoice, value=0)
self.sepchoice1.config(font=gv.mainfont)
self.sepchoice1.pack(side="left", anchor="s")
self.sepchoice2 = Radiobutton(self.sepF9, text="Space", variable=gv.sepchoice, value=1)
self.sepchoice2.config(font=gv.mainfont)
self.sepchoice2.pack(side="left", anchor="s")
self.sepchoice3 = Radiobutton(self.sepF9, text="Comma", variable=gv.sepchoice, value=2)
self.sepchoice3.config(font=gv.mainfont)
self.sepchoice3.pack(side="left", anchor="s")
self.sepF9.pack(side="bottom", anchor="w", pady=1)
def pack_datetime_row(self):
self.saveF99 = Frame(self)
self.rlabel99 = Label(self.saveF99, text="Include:")
self.rlabel99.config(width=20, anchor="e", font=gv.mainfont)
self.rlabel99.pack(side="left")
self.savebox91 = Checkbutton(self.saveF99, text="date", variable=gv.savedate)
self.savebox91.config(font=gv.mainfont)
self.savebox91.pack(side="left", anchor="s")
self.savebox92 = Checkbutton(self.saveF99, text="time", variable=gv.savetime)
self.savebox92.config(font=gv.mainfont)
self.savebox92.pack(side="left", anchor="s")
self.savebox93 = Checkbutton(self.saveF99, text="computer", variable=gv.savecomputer)
self.savebox93.config(font=gv.mainfont)
self.savebox93.pack(side="left", anchor="s")
self.savebox94 = Checkbutton(self.saveF99, text="refresh", variable=gv.saverefresh)
self.savebox94.config(font=gv.mainfont)
self.savebox94.pack(side="left", anchor="s")
self.savebox95 = Checkbutton(self.saveF99, text="trial order", variable=gv.savetrialorder)
self.savebox95.config(font=gv.mainfont)
self.savebox95.pack(side="left", anchor="s")
self.saveF99.pack(side="bottom", anchor="w", pady=1)
def pack_dataformat_row(self):
self.saveF8 = Frame(self)
self.rlabel8 = Label(self.saveF8, text="Save subject data in:")
self.rlabel8.config(width=20, anchor="e", font=gv.mainfont)
self.rlabel8.pack(side="left")
self.savechoice1 = Radiobutton(self.saveF8, text="Rows", variable=gv.savechoice, value=1, command=self.saveother)
self.savechoice1.config(font=gv.mainfont)
self.savechoice1.pack(side="left", anchor="s")
self.savechoice2 = Radiobutton(self.saveF8, text="Columns", variable=gv.savechoice, value=0, command=self.saveother)
self.savechoice2.config(font=gv.mainfont)
self.savechoice2.pack(side="left", anchor="s")
self.savechoice3 = Radiobutton(self.saveF8, text="AZK file", variable=gv.savechoice, value=-1, command=self.saveazk)
self.savechoice3.config(font=gv.mainfont)
self.savechoice3.pack(side="left", anchor="s")
self.savechoice4 = Radiobutton(self.saveF8, text="long format", variable=gv.savechoice, value=2, command=self.saveother)
self.savechoice4.config(font=gv.mainfont)
self.savechoice4.pack(side="left", anchor="s")
self.saveF8.pack(side="bottom", anchor="w")
def pack_timeout_row(self):
self.timeF5 = Frame(self)
self.rlabel51 = Label(self.timeF5, text="Timeout value:")
self.rlabel51.config(width=20, font=gv.mainfont, anchor="e")
self.rlabel51.pack(side="left")
self.timechoice1 = Radiobutton(self.timeF5, text="From DMDX item file", variable=gv.timechoice, value=0, command=self.timedmdx)
self.timechoice1.config(font=gv.mainfont)
self.timechoice1.pack(side="left", anchor="s")
self.timechoice2 = Radiobutton(self.timeF5, text="Set to", variable=gv.timechoice, value=1, command=self.timenew)
self.timechoice2.config(font=gv.mainfont)
self.timechoice2.pack(side="left", anchor="s")
self.tentry5 = Entry(self.timeF5, textvariable=gv.timetxt) # ,validate="key",validatecommand=self.valtime)
gv.timetxt.trace("w", self.timeout_edit)
self.ptimetxt = gv.timetxt.get()
self.tentry5.config(width=6, font=gv.mainfont)
self.tentry5.pack(side="left")
self.rlabel52 = Label(self.timeF5, text="ms")
self.rlabel52.config(width=2, font=gv.mainfont, anchor="w")
self.rlabel52.pack(side="left")
self.timeF5.pack(side="bottom", anchor="w")
def pack_blink_row(self):
self.blnkF6 = Frame(self)
self.rlabel6 = Label(self.blnkF6, text="Blink correct response:")
self.rlabel6.config(width=20, font=gv.mainfont, anchor="e")
self.rlabel6.pack(side="left")
self.blnkchoice1 = Radiobutton(self.blnkF6, text="Never", variable=gv.blnkchoice, value=0)
self.blnkchoice1.config(font=gv.mainfont)
self.blnkchoice1.pack(side="left", anchor="s")
self.blnkchoice2 = Radiobutton(self.blnkF6, text="Always", variable=gv.blnkchoice, value=1)
self.blnkchoice2.pack(side="left", anchor="s")
self.blnkchoice2.config(font=gv.mainfont)
self.blnkchoice3 = Radiobutton(self.blnkF6, text="On change", variable=gv.blnkchoice, value=-1)
self.blnkchoice3.pack(side="left", anchor="s")
self.blnkchoice3.config(font=gv.mainfont)
self.blnkF6.pack(side="bottom", anchor="w")
def pack_filename_row(self):
self.azkF1 = Frame(self)
self.rlabel1 = Label(self.azkF1, text=self.filename_prompt)
self.rlabel1.config(width=20, font=gv.mainboldfont, anchor="e")
self.rlabel1.pack(side="left")
self.rmessage1 = Label(self.azkF1, textvariable=gv.azkff, anchor="w")
self.rmessage1.config(width=60, font=gv.mainfont, background="white", foreground="black")
self.rmessage1.bind("<Button-1>", self.get_filename)
self.rmessage1.pack(side="left", pady=5)
self.rlabel10 = Label(self.azkF1, text=" ")
self.rlabel10.config(font=gv.mainboldfont)
self.rlabel10.pack(side="left")
self.azkF1.pack(side="bottom", anchor="w")
## end of widget setup
def startup(self):
self.status = 0 # startup
self.trigdmdx()
self.timedmdx()
self.focus_force()
self.get_filename()
def inrun(self):
self.status = 1 # inrun
# azk filename cannot be changed after startup
self.rmessage1.unbind("<Button-1>")
self.rlabel1.config(state=DISABLED)
self.rlabel10.config(state=DISABLED)
self.rmessage1.config(state=DISABLED)
# timeout should also not be changed once started, to prevent inconsistencies
self.rlabel51.config(state=DISABLED)
self.rlabel52.config(state=DISABLED)
self.timechoice1.config(state=DISABLED)
self.timechoice2.config(state=DISABLED)
self.tentry5.config(state=DISABLED)
# mode cannot be changed after startup
self.modechoice2a.config(state=DISABLED)
self.modechoice2b.config(state=DISABLED)
self.modechoice2c.config(state=DISABLED)
self.spinn2a.config(state=DISABLED)
#
self.cbutton01.config(state=DISABLED) # no reset
self.update()
def proceed(self, c_event=None):
gv.update()
if (self.status == 1): # inrun
self.parent.focus_set()
self.destroy()
else: # self.status==0, startup
self.destroy()
cv_process.run()
# self.mquit()
def mquit(self, c_event=None):
if (self.status == 1): # inrun
self.parent.focus_set()
self.destroy()
else: # self.status==0, startup
global_quit()
def reset(self):
gv.reset() # also resets the filename!
self.fileOK.set(False)
self.timedmdx()
self.trigdmdx()
def saveazk(self):
self.savebox95.config(state="disabled")
def saveother(self):
self.savebox95.config(state="normal")
def trigdmdx(self):
self.revtrigC.config(state="disabled")
## leave other choices active to adjust on-demand triggering
def trignew(self):
self.rlabel31.config(state="normal")
self.rmslim31.config(state="normal")
self.rlabel32.config(state="normal")
self.rlabel33.config(state="normal")
self.rmslim32.config(state="normal")
self.rlabel34.config(state="normal")
self.revtrigC.config(state="normal")
def timedmdx(self):
self.tentry5.config(state="disabled")
self.rlabel52.config(state="disabled")
self.timeoutOK.set(True)
def timenew(self):
self.tentry5.config(state="normal")
self.rlabel52.config(state="normal")
self.timeout_edit()
def timeout_edit(self, *dummy): # based on http://effbot.org/zone/tkinter-entry-validate.htm
strvalue = gv.timetxt.get()
newvalue = self.timeout_validate(strvalue)
# print "Checking timeout, got %s"%(newvalue)
if newvalue is None:
gv.timetxt.set(self.ptimetxt)
if (gv.timeout > 0):
self.timeoutOK.set(True)
elif (newvalue != strvalue):
gv.timetxt.set(newvalue)
self.ptimetxt = newvalue
if newvalue:
gv.timeout = int(newvalue)
if (gv.timeout > 0):
self.timeoutOK.set(True)
else:
self.timeoutOK.set(False)
else:
gv.timeout = 0
self.timeoutOK.set(False)
else:
self.ptimetxt = newvalue
if newvalue:
gv.timeout = int(newvalue)
if (gv.timeout > 0):
self.timeoutOK.set(True)
else:
self.timeoutOK.set(False)
else:
gv.timeout = 0
self.timeoutOK.set(False)
# print "gv.timetxt='%s' gv.timeout=%i self.ptimetxt='%s'"%(gv.timetxt.get(),gv.timeout,self.ptimetxt)
def timeout_validate(self, value):
if len(value) > 6: return None
try:
if value:
v = int(value)
return value
except ValueError:
return None
def mayproceed(self, *dummy):
if (self.fileOK.get() and self.timeoutOK.get()):
self.cbutton0.config(state="normal")
else:
self.cbutton0.config(state="disabled")
def save_expdir(self):
if _WINDOWS_:
try: # save selected expdir as last folder and close registry key
rkey = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, CV_REGISTRY_KEY, 0, _winreg.KEY_SET_VALUE)
_winreg.SetValueEx(rkey, "LastFolder", 0, _winreg.REG_SZ, gv.expdir)
_winreg.CloseKey(rkey)
except: # failed to update registry
msgwindow.display("Failed to update registry with selected folder\n")
# logfile not open yet, so cannot use logmsg
elif _MAC_:
basepath = os.path.expanduser(UBPATH)
cvpath = os.path.join(basepath, APPNAME)
if not os.path.exists(cvpath):
os.mkdir(cvpath)
msgwindow.display("System application folder created: %s\n" % (cvpath))
pl = dict(lastfolder=gv.expdir)
try:
plistlib.writePlist(pl, os.path.join(cvpath, PLISTFNAME))
except: # failed to update
msgwindow.display("Failed to update registry with selected folder\n")
# logfile not open yet, so cannot use logmsg
def get_filename(self, c_event=None):
filename = tkFileDialog.askopenfilename(parent=self.parent, initialdir=gv.lastfolder,
filetypes=[('DMDX data files', '*.azk')],
title="Choose a DMDX results file")
if (len(filename) > 0):
gv.expdir = os.path.dirname(filename) + "/"
gv.lastfolder = gv.expdir
try:
os.chdir(gv.expdir)
except OSError:
exiterror("Unable to work in this folder -- check security permissions")
gv.expname = os.path.splitext(os.path.basename(filename))[0]
gv.azkff.set(filename)
self.fileOK.set(True)
self.save_expdir()
elif (len(gv.azkff.get()) == 0):
self.fileOK.set(False)
class SetupWindow_Files(SetupWindow):
def __init__(self, parent):
Toplevel.__init__(self, parent)
# self.transient(parent) # cannot be transient, parent is root (withdrawn)
self.parent = parent
self.filename_prompt = "Audio files location:"
self.setup_window(u"CheckVocal files setup")
def get_filename(self, c_event=None):
filename = tkFileDialog.askdirectory(parent=self.parent, initialdir=gv.lastfolder,
title="Choose the folder with your audio files")
if (len(filename) > 0):
gv.expdir = filename + "/"
gv.lastfolder = gv.expdir
try:
os.chdir(gv.expdir)
except OSError:
exiterror("Unable to work in this folder -- check security permissions")
gv.expname = FILES_EXPNAME
gv.azkff.set(filename)
self.fileOK.set(True)
self.save_expdir()
elif (len(gv.azkff.get()) == 0):
self.fileOK.set(False)
def pack_dataformat_row(self):
pass
def pack_datetime_row(self):
pass
def pack_timeout_row(self):
self.timeF5 = Frame(self)
self.rlabel51 = Label(self.timeF5, text="Timeout value:")
self.rlabel51.config(width=20, font=gv.mainfont, anchor="e")
self.rlabel51.pack(side="left")
self.tentry5 = Entry(self.timeF5, textvariable=gv.timetxt) # ,validate="key",validatecommand=self.valtime)
gv.timetxt.trace("w", self.timeout_edit)
self.ptimetxt = gv.timetxt.get()
self.tentry5.config(width=6, font=gv.mainfont)
self.tentry5.pack(side="left")
self.rlabel52 = Label(self.timeF5, text="ms")
self.rlabel52.config(width=2, font=gv.mainfont, anchor="w")
self.rlabel52.pack(side="left")
self.timeF5.pack(side="bottom", anchor="w")
def pack_voxtrigger_row(self):
self.rmsF3 = Frame(self)
self.rlabel30 = Label(self.rmsF3, text=" ")
self.rlabel30.config(width=20, font=gv.mainfont, anchor="e")
self.rlabel30.pack(side="left", anchor="e")
self.rlabel31 = Label(self.rmsF3, text="RMS threshold:")
self.rlabel31.config(width=12, font=gv.mainfont, anchor="e")
self.rlabel31.pack(side="left", anchor="e")
self.rmslim31 = Spinbox(self.rmsF3, from_=1, to=90)
self.rmslim31.config(width=3, font=gv.mainfont, textvariable=gv.rmstxt)
self.rmslim31.pack(side="left")
self.rlabel32 = Label(self.rmsF3, text="dB")
self.rlabel32.config(width=2, font=gv.mainfont, anchor="w")
self.rlabel32.pack(side="left")
self.rlabel33 = Label(self.rmsF3, text="Window length: ")
self.rlabel33.config(width=14, font=gv.mainfont, anchor="e")
self.rlabel33.pack(side="left")
self.rmslim32 = Spinbox(self.rmsF3, from_=1, to=30)
self.rmslim32.config(width=3, font=gv.mainfont, textvariable=gv.wdutxt)
self.rmslim32.pack(side="left")
self.rlabel34 = Label(self.rmsF3, text="ms")
self.rlabel34.config(width=2, font=gv.mainfont, anchor="w")
self.rlabel34.pack(side="left")
self.rmsF3.pack(side="bottom", anchor="w")
self.trigF4 = Frame(self)
self.rlabel4 = Label(self.trigF4, text="RT marks from:")
self.rlabel4.config(width=20, anchor="e", font=gv.mainfont)
self.rlabel4.pack(side="left")
## self.trigchoice1=Radiobutton(self.trigF4,text="DMDX Vox",variable=gv.trigchoice,value=0,command=self.trigdmdx)
## self.trigchoice1.config(font=gv.mainfont)
## self.trigchoice1.pack(side="left",anchor="s")
self.trigchoice2 = Radiobutton(self.trigF4, text="CheckVocal", variable=gv.trigchoice, value=1, command=self.trignew)
self.trigchoice2.config(width=9, font=gv.mainfont)
self.trigchoice2.pack(side="left", anchor="s")
self.trigchoice2.config(state="disabled") # this should not appear changeable
self.filtdcC = Checkbutton(self.trigF4, text="Remove DC", variable=gv.removeDCchoice)
self.filtdcC.config(font=gv.mainfont)
self.filtdcC.pack(side="left", anchor="s", padx=2)
self.revtrigC = Checkbutton(self.trigF4, text="Reverse (mark end)", variable=gv.reversetriggerchoice)
self.revtrigC.config(font=gv.mainfont)
self.revtrigC.pack(side="left", anchor="s", padx=2)
self.trigF4.pack(side="bottom", anchor="w", pady=1)
def startup(self):
self.status = 0 # startup
gv.savechoice.set(0)
gv.trigchoice.set(1)
gv.timechoice.set(1)
self.trignew()