def select_start_options(self):
    '''
    popup box to select side and difficulty levels
    '''
    print 'select game start options'

    popup = Toplevel(self.gui, width=300, height=110)
    popup.title('Choose Game Side and Level')

    # stays on top of the game canvass
    popup.transient(self.gui)
    popup.grab_set()

    # bind window close events
    popup.bind('<Escape>', lambda e: self.not_selected_start_options(popup))
    popup.protocol("WM_DELETE_WINDOW", lambda : self.not_selected_start_options(popup))

    # choose side
    label1 = Label(popup, text="Side", height=30, width=50)
    label1.place(x=10, y=5, height=30, width=50)

    val1 = IntVar()

    bt_north = Radiobutton(popup, text="White", variable=val1, value=1)
    bt_north.place(x=60, y=10)
    bt_south = Radiobutton(popup, text="Black", variable=val1, value=2)
    bt_south.place(x=120, y=10)

    # by default, human plays first, meaning play the north side
    if self.choose_side == 'north':
      bt_north.select()
    else:
      bt_south.select()

    # choose difficulty level
    label2 = Label(popup, text="Level", height=30, width=50)
    label2.place(x=10, y=35, height=30, width=50)

    val2 = IntVar()

    bt_level1 = Radiobutton(popup, text="Dumb", variable=val2, value=1)
    bt_level1.place(x=60, y=40)
    bt_level2 = Radiobutton(popup, text="Smart", variable=val2, value=2)
    bt_level2.place(x=120, y=40)
    bt_level3 = Radiobutton(popup, text="Genius", variable=val2, value=3)
    bt_level3.place(x=180, y=40)

    # by default, the game is medium level
    if self.choose_level == 1:
      bt_level1.select()
    elif self.choose_level == 2:
      bt_level2.select()
    elif self.choose_level == 3:
      bt_level3.select()

    button = Button(popup, text='SET', \
              command=lambda: self.selected_start_options(popup, val1, val2))

    button.place(x=70, y=70)
Beispiel #2
0
def init():
    """初始化页面"""
    global face_file_list, face_image, face_label, detect_label

    all_files = os.listdir(image_dir)
    face_file_list = filter(lambda x: x.endswith('jpg'), all_files)
    get_face_record(offset)


    place_image(offset)
    face_image = Label(master, image=tk_image)
    face_image.place(anchor=u'nw', x=10, y=40)

    face_label = IntVar()
    face_label.set(face_record.label)
    score_ugly = Radiobutton(master, text=u'丑', variable=face_label,
                             value=0, command=set_face_label)
    score_ugly.place(anchor=u'nw', x=120, y=10)
    score_normal = Radiobutton(master, text=u'一般', variable=face_label,
                               value=1, command=set_face_label)
    score_normal.place(anchor=u'nw', x=160, y=10)
    score_pretty = Radiobutton(master, text=u'漂亮', variable=face_label,
                               value=2, command=set_face_label)
    score_pretty.place(anchor=u'nw', x=220, y=10)

    detect_label = Label(master, text=u'')
    detect_label.place(anchor=u'nw', x=580, y=10)

    handle_detect()
Beispiel #3
0
def init():
    """初始化页面"""
    global user, offset, photo, url, buy_house, buy_car, age, height, salary, \
        education, company, industry, school, position, satisfy, appearance
    get_user(offset)
    image_url = u'{}&quality=85&thumbnail=410y410'.format(user['avatar'])
    place_image(image_url)

    photo = Label(master, image=tk_image)
    photo.place(anchor=u'nw', x=10, y=40)
    url = Label(master, text=user['url'], font=Font(size=20, weight='bold'))
    url.place(anchor=u'nw', x=10, y=5)
    buy_house = Label(master, text=BUY_HOUSE.get(user['house']) or user['house'])
    buy_house.place(anchor=u'nw', x=490, y=50)
    buy_car = Label(master, text=BUY_CAR.get(user['car']) or user['car'])
    buy_car.place(anchor=u'nw', x=490, y=75)
    age = Label(master, text=user['age'])
    age.place(anchor=u'nw', x=490, y=100)
    height = Label(master, text=user['height'])
    height.place(anchor=u'nw', x=490, y=125)
    salary = Label(master, text=SALARY.get(user['salary']) or user['salary'])
    salary.place(anchor=u'nw', x=490, y=150)
    education = Label(master, text=EDUCATION.get(user['education']) or user['education'])
    education.place(anchor=u'nw', x=490, y=175)
    company = Label(master, text=user['company'] if user['company'] else u'--')
    company.place(anchor=u'nw', x=490, y=200)
    industry = Label(master, text=INDUSTRY.get(user['industry']) or user['industry'])
    industry.place(anchor=u'nw', x=490, y=225)
    school = Label(master, text=user['school'] if user['school'] else u'--')
    school.place(anchor=u'nw', x=490, y=250)
    position = Label(master, text=POSITION.get(user['position']) or user['position'])
    position.place(anchor=u'nw', x=490, y=275)

    satisfy = IntVar()
    satisfy.set(int(user.get(u'satisfy', -1)))
    satisfied = Radiobutton(master, text=u"满意", variable=satisfy,
                            value=1, command=set_satisfy)
    not_satisfied = Radiobutton(master, text=u"不满意", variable=satisfy,
                                value=0, command=set_satisfy)
    satisfied.place(anchor=u'nw', x=450, y=10)
    not_satisfied.place(anchor=u'nw', x=510, y=10)

    appearance = IntVar()
    appearance.set(int(user.get(u'appearance', -1)))
    for i in range(1, 11):
        score_i = Radiobutton(master, text=str(i), variable=appearance,
                              value=i, command=set_appearance)
        score_i.place(anchor=u'nw', x=i * 40 - 30, y=460)
Beispiel #4
0
        lmain.imgtk = imgtk
        lmain.configure(image=imgtk)
        while counter != 100:
            counter += 1
            lmain.after(10, show_frame)

    show_frame()
    # cap.release()





R00 = Radiobutton(top, text="Single Image", variable=var00, value=1, command=var00Sel)
R00.invoke()
R00.place(x = 180, y = 15)

R01 = Radiobutton(top, text="Webcam", variable=var00, value=2, command=var00Sel)
R01.place(x = 350, y = 15)



label1 = tkinter.Label(top, text = "Low-Resolution Image", relief=RAISED)
label1.config(width = 50)
label1.place(x = 180, y = 50)



def click1():
    filename = filedialog.askopenfilename(initialdir='/Desktop')
    var1.set(filename)
Beispiel #5
0
def init():
    """初始化页面"""
    global user, offset, photo, url, buy_house, buy_car, age, height, salary, \
        education, company, industry, school, position, satisfy, appearance
    get_user(offset)
    image_url = u'{}&quality=85&thumbnail=410y410'.format(user['avatar'])
    place_image(image_url)

    photo = Label(master, image=tk_image)
    photo.place(anchor=u'nw', x=10, y=40)
    url = Label(master, text=user['url'], font=Font(size=20, weight='bold'))
    url.place(anchor=u'nw', x=10, y=5)
    buy_house = Label(master,
                      text=BUY_HOUSE.get(user['house']) or user['house'])
    buy_house.place(anchor=u'nw', x=490, y=50)
    buy_car = Label(master, text=BUY_CAR.get(user['car']) or user['car'])
    buy_car.place(anchor=u'nw', x=490, y=75)
    age = Label(master, text=user['age'])
    age.place(anchor=u'nw', x=490, y=100)
    height = Label(master, text=user['height'])
    height.place(anchor=u'nw', x=490, y=125)
    salary = Label(master, text=SALARY.get(user['salary']) or user['salary'])
    salary.place(anchor=u'nw', x=490, y=150)
    education = Label(master,
                      text=EDUCATION.get(user['education'])
                      or user['education'])
    education.place(anchor=u'nw', x=490, y=175)
    company = Label(master, text=user['company'] if user['company'] else u'--')
    company.place(anchor=u'nw', x=490, y=200)
    industry = Label(master,
                     text=INDUSTRY.get(user['industry']) or user['industry'])
    industry.place(anchor=u'nw', x=490, y=225)
    school = Label(master, text=user['school'] if user['school'] else u'--')
    school.place(anchor=u'nw', x=490, y=250)
    position = Label(master,
                     text=POSITION.get(user['position']) or user['position'])
    position.place(anchor=u'nw', x=490, y=275)

    satisfy = IntVar()
    satisfy.set(int(user.get(u'satisfy', -1)))
    satisfied = Radiobutton(master,
                            text=u"满意",
                            variable=satisfy,
                            value=1,
                            command=set_satisfy)
    not_satisfied = Radiobutton(master,
                                text=u"不满意",
                                variable=satisfy,
                                value=0,
                                command=set_satisfy)
    satisfied.place(anchor=u'nw', x=450, y=10)
    not_satisfied.place(anchor=u'nw', x=510, y=10)

    appearance = IntVar()
    appearance.set(int(user.get(u'appearance', -1)))
    for i in range(1, 11):
        score_i = Radiobutton(master,
                              text=str(i),
                              variable=appearance,
                              value=i,
                              command=set_appearance)
        score_i.place(anchor=u'nw', x=i * 40 - 30, y=460)
Beispiel #6
0
    def initUI(self):
        """
        Initializes the user interface

        Setting up the entry widgets for:
        - Experiment_ID
        - Participant Name
        - Session Day
        - Pupil Size
        - Practice
        - Stereo
        """
        # Set the title
        self.parent.title(EXP_NAME)

        # Create the label for Experiment_ID and set location
        label_id = Label(text='Participant ID:')
        label_id.place(x=20, y=20)

        # Check the DATA_DIR directory for previous participants
        # and choose the next Experiment_ID in line
        self.folders = listdir(DATA_DIR)
        # Initiate Tkinter's StringVar
        self.value_id = StringVar()
        # Set the default value
        self.value_id.set('001')
        # Going in reverse order of the participants' directories in
        # DATA_DIR, find the last participant's Experiment_ID and opt
        # for the next one in line
        for folder in reversed(self.folders):
            try:
                # Check if the value of the first 3 digits of the
                # directory name is greater than the default value
                if int(folder[:3]) >= int(self.value_id.get()):
                    # Get the next Experiment_ID in integer form and
                    # convert to string format
                    num = str(int(folder[:3]) + 1)
                    # Actions to perform in case scenarios for each
                    # of the possibilites of num_length
                    num_length = {3: num, 2: '0%s' % num, 1: '00%s' % num}
                    # Set the value accordingly to the StringVar,
                    # replacing the default
                    self.value_id.set(num_length[len(num)])
            # In case there are other folders in DATA_DIR, for which
            # the first 3 characters are not digits, we must cater
            # for when an exception is thrown up
            except ValueError:
                pass
        # Create the entry widget for Experiment_ID with the preset
        # value and state disabled
        self.input_id = Entry(self.parent,
                              width=5,
                              state=DISABLED,
                              textvariable=self.value_id)
        self.input_id.place(x=150, y=20)

        # Create the label for Participant Name and set location
        label_name = Label(text='Participant Name:')
        label_name.place(x=20, y=50)

        # Initiate Tkinter's StringVar
        self.value_name = StringVar()
        # Set the default value
        self.value_name.set('')
        # Create the entry for Participant Name and set location
        self.input_name = Entry(self.parent,
                                width=35,
                                textvariable=self.value_name)
        self.input_name.place(x=150, y=50)
        self.input_name.focus()

        # Create the label for Session Day and set location
        label_day = Label(text='Session Day:')
        label_day.place(x=20, y=80)

        # Create value holder for Session Day as IntVar and set default
        # value to 1
        self.value_day = IntVar()
        self.value_day.set(1)
        # Create the radiobuttons as required
        for day in range(1, TOTAL_SESSIONS + 1):
            input_day = Radiobutton(self.parent,
                                    text=str(day),
                                    variable=self.value_day,
                                    value=day)
            # Anchor them to the West (W)
            input_day.pack(anchor=W)
            # Choose location for the radiobuttons
            input_day.place(x=150, y=(50 + (day * 25)))

        # Create the label for Pupil Size and set location
        label_pupilsize = Label(text='Pupil Size:')
        label_pupilsize.place(x=20, y=140)

        self.value_pupilsize = StringVar()
        self.value_pupilsize.set('')
        # Create the MaxLengthEntry for Pupil Size and set location
        # The maximum length is set to 3 characters and a float must be
        # provided
        self.input_pupilsize = MaxLengthEntry(self.parent,
                                              width=5,
                                              maxlength=3,
                                              required_type=float)
        self.input_pupilsize.config(textvariable=self.value_pupilsize)
        self.input_pupilsize.place(x=150, y=140)

        # Create value folder for Practice as IntVar
        self.value_practice = IntVar()
        # Create the checkbutton for Practice and set location
        input_practice = Checkbutton(self.parent,
                                     text='Practice',
                                     variable=self.value_practice,
                                     onvalue=1,
                                     offvalue=0)
        input_practice.place(x=150, y=170)

        # Create value holder for Stereo as IntVar
        self.value_stereo = IntVar()
        # Create the checkbutton for Stereo and set location
        input_stereo = Checkbutton(self.parent,
                                   text='Stereo',
                                   variable=self.value_stereo,
                                   onvalue=1,
                                   offvalue=0)
        input_stereo.place(x=150, y=200)

        # Create the label for Previous Subjects and set location
        label_previous = Label(text='Previous Subjects:')
        label_previous.place(x=20, y=250)

        # Create the Listboc containing all the previous participants
        self.input_previous = Listbox(self.parent, width=35, height=10)
        for identifier in self.folders:
            self.input_previous.insert(END, identifier)
        self.input_previous.place(x=150, y=250)
        self.input_previous.bind('<<ListboxSelect>>', self.__select_previous)

        # Create the submit button, give command upon pressing and set
        # location
        submit = Button(text='Submit', width=47, command=self.gather_input)
        submit.pack(padx=8, pady=8)
        submit.place(x=20, y=425)
Beispiel #7
0
    def select_start_options(self):
        '''
    popup box to select side and difficulty levels
    '''
        print 'select game start options'

        popup = Toplevel(self.gui, width=300, height=110)
        popup.title('Choose Game Side and Level')

        # stays on top of the game canvass
        popup.transient(self.gui)
        popup.grab_set()

        # bind window close events
        popup.bind('<Escape>',
                   lambda e: self.not_selected_start_options(popup))
        popup.protocol("WM_DELETE_WINDOW",
                       lambda: self.not_selected_start_options(popup))

        # choose side
        label1 = Label(popup, text="Side", height=30, width=50)
        label1.place(x=10, y=5, height=30, width=50)

        val1 = IntVar()

        bt_north = Radiobutton(popup, text="White", variable=val1, value=1)
        bt_north.place(x=60, y=10)
        bt_south = Radiobutton(popup, text="Black", variable=val1, value=2)
        bt_south.place(x=120, y=10)

        # by default, human plays first, meaning play the north side
        if self.choose_side == 'north':
            bt_north.select()
        else:
            bt_south.select()

        # choose difficulty level
        label2 = Label(popup, text="Level", height=30, width=50)
        label2.place(x=10, y=35, height=30, width=50)

        val2 = IntVar()

        bt_level1 = Radiobutton(popup, text="Dumb", variable=val2, value=1)
        bt_level1.place(x=60, y=40)
        bt_level2 = Radiobutton(popup, text="Smart", variable=val2, value=2)
        bt_level2.place(x=120, y=40)
        bt_level3 = Radiobutton(popup, text="Genius", variable=val2, value=3)
        bt_level3.place(x=180, y=40)

        # by default, the game is medium level
        if self.choose_level == 1:
            bt_level1.select()
        elif self.choose_level == 2:
            bt_level2.select()
        elif self.choose_level == 3:
            bt_level3.select()

        button = Button(popup, text='SET', \
                  command=lambda: self.selected_start_options(popup, val1, val2))

        button.place(x=70, y=70)
Beispiel #8
0
class MyQuestion(object):
    def __init__(self, parent, question_text, ans1_text, ans2_text, ans3_text,
                 ans4_text, exp1_text, exp2_text, exp3_text, exp4_text,
                 correct_ans):
        # assigning parameters to attributes
        self.parent = parent
        self.qtext = str(question_text)
        self.text1 = str(ans1_text)
        self.text2 = str(ans2_text)
        self.text3 = str(ans3_text)
        self.text4 = str(ans4_text)
        self.exp1 = str(exp1_text)
        self.exp2 = str(exp2_text)
        self.exp3 = str(exp3_text)
        self.exp4 = str(exp4_text)
        self.ans = int(correct_ans)

        # creating Tkinter variables
        self.ans_input = IntVar()
        self.is_correct = BooleanVar()
        self.efbg = StringVar()
        self.is_correct_text = StringVar()
        self.exp_text = StringVar()

        # developer mode
        if dev:
            self.ans_input.set(self.ans)

        # questionwide bgcolor, fgcolor
        self.bgcolor = GrayScale(80)
        self.fgcolor = GrayScale(20)

        # creating parent frame
        self.parent_frame()
        self.question_frame()

    def parent_frame(self):
        # creating parent frame
        self.pf = Frame(self.parent)
        self.pf.configure(bg=self.bgcolor)
        self.pf.place(relx=0, rely=0, relwidth=1, relheight=1)

    def question_frame(self):
        # creating question frame within parent frame
        self.qf = Frame(self.pf)
        self.qf.configure(bg=self.bgcolor)
        self.qf.place(relx=0, rely=0, relwidth=1, relheight=1)

        # creating objects within question frame
        self.title_label()
        self.radiobutton1()
        self.radiobutton2()
        self.radiobutton3()
        self.radiobutton4()
        self.check_ans_button()

    def explanation_frame(self):
        # creating explanation frame within parent frame
        self.ef = Frame(self.pf)
        self.ef.configure(bg=self.efbg.get())
        self.ef.place(relx=0, rely=0, relwidth=1, relheight=1)

        # creating objects within explanation frame
        self.is_correct_label()
        self.exp_label()
        self.next_ques_button()

        # creating display answer button if answer is wrong
        if not self.is_correct.get():
            self.disp_ans_button()

    def title_label(self):
        # creating title label for question frame
        self.tl = Label(self.qf)
        self.tl.configure(text=self.qtext)
        self.tl.configure(font=MyFonts['ExtraLarge'])
        self.tl.configure(bg=self.bgcolor, fg=self.fgcolor)
        self.tl.configure(relief=FLAT)
        self.tl.configure(padx=2, pady=2, anchor=N)
        self.tl.place(relx=0.05, rely=0.05, relwidth=0.90, relheight=0.10)

    def radiobutton1(self):
        # creating radiobuttion1 for question frame
        self.q1 = Radiobutton(self.qf)
        self.q1.configure(text='A. ' + self.text1)
        self.q1.configure(font=MyFonts['Large'])
        self.q1.configure(bg=self.bgcolor, activebackground=self.bgcolor)
        self.q1.configure(variable=self.ans_input, value=1)
        self.q1.place(relx=0.10, rely=0.20)

    def radiobutton2(self):
        # creating radiobutton2 for question frame
        self.q2 = Radiobutton(self.qf)
        self.q2.configure(text='B. ' + self.text2)
        self.q2.configure(font=MyFonts['Large'])
        self.q2.configure(bg=self.bgcolor, activebackground=self.bgcolor)
        self.q2.configure(variable=self.ans_input, value=2)
        self.q2.place(relx=0.10, rely=0.35)

    def radiobutton3(self):
        # creating radiobutton3 for question frame
        self.q3 = Radiobutton(self.qf)
        self.q3.configure(text='C. ' + self.text3)
        self.q3.configure(font=MyFonts['Large'])
        self.q3.configure(bg=self.bgcolor, activebackground=self.bgcolor)
        self.q3.configure(variable=self.ans_input, value=3)
        self.q3.place(relx=0.10, rely=0.50)

    def radiobutton4(self):
        # creating radiobutton4 for question frame
        self.q4 = Radiobutton(self.qf)
        self.q4.configure(text='D. ' + self.text4)
        self.q4.configure(font=MyFonts['Large'])
        self.q4.configure(bg=self.bgcolor, activebackground=self.bgcolor)
        self.q4.configure(variable=self.ans_input, value=4)
        self.q4.place(relx=0.10, rely=0.65)

    def check_ans_button(self):
        # creating check answer button for question frame
        self.cb = MyButton(self.qf, 'Check Answer', self.check_ans, 0.80, 0.85)

    def is_correct_label(self):
        # creating is_correct_label for explanation frame
        self.cl = Label(self.ef)
        self.cl.configure(text=self.is_correct_text.get())
        self.cl.configure(font=MyFonts['ExtraLargeBold'])
        self.cl.configure(bg=self.efbg.get(), fg=GrayScale(20))
        self.cl.configure(relief=FLAT)
        self.cl.configure(padx=2, pady=2, anchor=N)
        self.cl.place(relx=0.05, rely=0.05, relwidth=0.90, relheight=0.05)

    def exp_label(self):
        # creating exp_label for explanation frame
        self.el = Label(self.ef)
        self.el.configure(text=self.exp_text.get())
        self.el.configure(font=MyFonts['LargeBold'])
        self.el.configure(bg=self.efbg.get(), fg=GrayScale(20))
        self.el.configure(relief=FLAT)
        self.el.configure(padx=2, pady=2, anchor=N)
        self.el.place(relx=0.05, rely=0.10, relwidth=0.90, relheight=0.85)

    def next_ques_button(self):
        # creating next question button for explanation frame
        self.nq = MyButton(self.ef, 'Next Question', self.next_ques, 0.80,
                           0.85)

    def disp_ans_button(self):
        # creating display answer button for explanation frame
        self.da = MyButton(self.ef, 'Show Answer', self.disp_ans, 0.65, 0.85)

    def assign_all(self):
        # assigning correct answer text (ans_text) and explanation attributes (ans_exp)
        if self.ans == 1:
            self.ans_text = 'A. ' + self.text1
            self.ans_exp = self.exp1
        elif self.ans == 2:
            self.ans_text = 'B. ' + self.text2
            self.ans_exp = self.exp2
        elif self.ans == 3:
            self.ans_text = 'C. ' + self.text3
            self.ans_exp = self.exp3
        elif self.ans == 4:
            self.ans_text = 'D. ' + self.text4
            self.ans_exp = self.exp4
        else:
            self.ans_text = 'invalid correct_ans parameter'
            self.ans_exp = 'invalid correct_ans parameter'
            print 'invalid correct_ans parameter, please input between 1 and 4'

    def check_ans(self):
        # defining check answer function

        # is_correct (Boolean conditional)
        if self.ans_input.get() == self.ans:
            self.efbg.set(color_green)
            self.is_correct.set(True)
            self.is_correct_text.set('Correct Answer! :)')

        else:
            self.efbg.set(color_red)
            self.is_correct.set(False)
            self.is_correct_text.set('Wrong Answer :(')

            # only assign values for show answer if user answer is wrong
            self.assign_all()

        # appropriate response to selected answer
        if self.ans_input.get() == 1:
            self.exp_text.set(self.exp1)
            self.explanation_frame()
            self.qf.destroy()

        elif self.ans_input.get() == 2:
            self.exp_text.set(self.exp2)
            self.explanation_frame()
            self.qf.destroy()

        elif self.ans_input.get() == 3:
            self.exp_text.set(self.exp3)
            self.explanation_frame()
            self.qf.destroy()

        elif self.ans_input.get() == 4:
            self.exp_text.set(self.exp4)
            self.explanation_frame()
            self.qf.destroy()

        else:
            # no selected answer condition
            showerror('Error', 'Please select an answer to continue')

    def disp_ans(self):
        # defining display answer function
        tmp_str = self.ans_exp[0].lower() + self.ans_exp[1:]
        disp_ans_text = 'The correct answer is "' + str(
            self.ans_text) + '" because ' + str(tmp_str)
        showinfo('Correct Answer', disp_ans_text)

    def next_ques(self):
        # defininf next_question function
        self.pf.destroy()
        self.ef.destroy()
Beispiel #9
0
class MyFirstGUI:
    def __init__(self, master):
        self.master = master
        master.title("listening window")

        self.label = Label(master, text="This is our first GUI!")
        self.label.pack()
        self.label.place(x=100, y=30)

        self.label_2 = Label(master, text="Enter the name if you see fit: ")
        self.label_2.pack()
        self.label_2.place(x=100, y=5)

        self.message = StringVar()
        self.entry = Entry(textvariable=self.message)
        self.entry.place(x=320, y=15, anchor="c")

        self.label_word = Label(master, text="Vocalize: a")
        self.label_word.pack()
        self.label_word.place(x=120, y=60)

        self.var = IntVar()
        self.var.set(0)

        self.checkRU = Radiobutton(master, value=0, variable=self.var, text="Russian")
        self.checkRU.pack()
        self.checkRU.place(x=310, y=30)

        self.checkEn = Radiobutton(master, value=1, variable=self.var, text="English")
        self.checkEn.pack()
        self.checkEn.place(x=310, y=60)

        self.start_button = Button(master, text="Start recording", width=11, command=self.greet)
        self.start_button.pack()
        self.start_button.place(x=210, y=30)

        self.close_button = Button(master, text="Close", width=11, command=master.quit)
        self.close_button.pack()
        self.close_button.place(x=210, y=60)

        self.alphabet_english = [x for x in 'abcdefghijklmnopqrstuvwxyz']
        self.alphabet_russian = [x for x in unicode('абвгдежзийклмнопрстуфхцчшщыэюя', "utf-8")]
        self.x = voice_recording

        self.close_button = Button(master, text="Redirect", width=11, command=self.redirect)
        self.close_button.pack()
        self.close_button.place(x=210, y=90)

    def greet(self):
        if self.var.get() == 0:
            str_alphabet = "абвгдежзийклмнопрстуфхцчшщыэюя"
        else:
            str_alphabet = "abcdefghijklmnopqrstuvwxyz"

        if (self.var.get() == 1) and (not self.alphabet_english):
            print("List is empty")
            self.alphabet_english = [x for x in str_alphabet]
        elif (self.var.get() == 0) and (not self.alphabet_russian):
            self.alphabet_russian = [x for x in unicode(str_alphabet, "utf-8")]

        if self.var.get() == 0:
            number = self.alphabet_russian.pop(0)
        else:
            number = self.alphabet_english.pop(0)
        print (number)

        name = "default"

        if self.message.get():
            name = self.message.get()

        self.x.my_record(name + "_" + number + ".wav")

        if self.alphabet_english and self.var.get() == 1:
            self.label_word['text'] = "Vocalize: " + self.alphabet_english[0]
        elif self.alphabet_english and self.var.get() == 0:
            self.label_word['text'] = "Vocalize: " + self.alphabet_russian[0]
        else:
            self.label_word['text'] = 'Vocalize: a'
            subprocess.call("python voice_acting.py combined.wav", shell=True)

    def redirect(self):
        subprocess.call("python read_GUI.py " + self.message.get())
Beispiel #10
0
class _Hatch_GUI(object):
    """
    create a Hatch object from
    hatch_supt and to then create a skeleton python project.
    """
    def __init__(self, master):
        self.initComplete = 0
        self.master = master
        self.x, self.y, self.w, self.h = -1, -1, -1, -1

        # bind master to <Configure> in order to handle any resizing, etc.
        # postpone self.master.bind("<Configure>", self.Master_Configure)
        self.master.bind('<Enter>', self.bindConfigure)

        self.master.title("PyHatch GUI")
        self.master.resizable(0, 0)  # Linux may not respect this

        dialogframe = Frame(master, width=810, height=630)
        dialogframe.pack()

        self.Shortdesc_Labelframe = LabelFrame(
            dialogframe,
            text="Short Description (1-liner)",
            height="90",
            width="718")
        self.Shortdesc_Labelframe.place(x=60, y=127)

        helv20 = tkFont.Font(family='Helvetica', size=20, weight='bold')

        self.Buildproject_Button = Button(dialogframe,
                                          text="Build Project",
                                          width="15",
                                          font=helv20)
        self.Buildproject_Button.place(x=492, y=10, width=263, height=68)
        self.Buildproject_Button.bind("<ButtonRelease-1>",
                                      self.Buildproject_Button_Click)

        self.Selectdir_Button = Button(dialogframe,
                                       text="<Select Directory>",
                                       width="15")
        self.Selectdir_Button.place(x=72, y=585, width=672, height=31)
        self.Selectdir_Button.bind("<ButtonRelease-1>",
                                   self.Selectdir_Button_Click)

        self.Author_Entry = Entry(dialogframe, width="15")
        self.Author_Entry.place(x=228, y=424, width=187, height=21)
        self.Author_Entry_StringVar = StringVar()
        self.Author_Entry.configure(textvariable=self.Author_Entry_StringVar)
        self.Author_Entry_StringVar.set("John Doe")

        self.Classname_Entry = Entry(dialogframe, width="15")
        self.Classname_Entry.place(x=192, y=73, width=165, height=21)
        self.Classname_Entry_StringVar = StringVar()
        self.Classname_Entry.configure(
            textvariable=self.Classname_Entry_StringVar)
        self.Classname_Entry_StringVar.set("MyClass")

        self.Copyright_Entry = Entry(dialogframe, width="15")
        self.Copyright_Entry.place(x=228, y=478, width=461, height=21)
        self.Copyright_Entry_StringVar = StringVar()
        self.Copyright_Entry.configure(
            textvariable=self.Copyright_Entry_StringVar)
        self.Copyright_Entry_StringVar.set("Copyright (c) 2013 John Doe")

        self.Email_Entry = Entry(dialogframe, relief="sunken", width="15")
        self.Email_Entry.place(x=228, y=505, width=458, height=21)
        self.Email_Entry_StringVar = StringVar()
        self.Email_Entry.configure(textvariable=self.Email_Entry_StringVar)
        self.Email_Entry_StringVar.set("*****@*****.**")

        self.GithubUserName_Entry = Entry(dialogframe,
                                          relief="sunken",
                                          width="15")
        self.GithubUserName_Entry.place(x=228, y=539, width=458, height=21)
        self.GithubUserName_Entry_StringVar = StringVar()
        self.GithubUserName_Entry.configure(
            textvariable=self.GithubUserName_Entry_StringVar)
        self.GithubUserName_Entry_StringVar.set("github_user_name")

        self.Funcname_Entry = Entry(dialogframe, width="15")
        self.Funcname_Entry.place(x=192, y=100, width=157, height=21)
        self.Funcname_Entry_StringVar = StringVar()
        self.Funcname_Entry.configure(
            textvariable=self.Funcname_Entry_StringVar)
        self.Funcname_Entry_StringVar.set("my_function")

        # License values should be correct format
        LICENSE_OPTIONS = tuple(sorted(CLASSIFIER_D.keys()))
        self.License_Entry_StringVar = StringVar()
        self.License_Entry = OptionMenu(dialogframe,
                                        self.License_Entry_StringVar,
                                        *LICENSE_OPTIONS)
        self.License_Entry.place(x=552, y=424, width=184, height=21)
        self.License_Entry_StringVar.set(LICENSE_OPTIONS[0])

        self.Mainpyname_Entry = Entry(dialogframe, width="15")
        self.Mainpyname_Entry.place(x=168, y=37, width=196, height=21)
        self.Mainpyname_Entry_StringVar = StringVar()
        self.Mainpyname_Entry.configure(
            textvariable=self.Mainpyname_Entry_StringVar)
        self.Mainpyname_Entry_StringVar.set("main.py")

        self.Projname_Entry = Entry(dialogframe, width="15")
        self.Projname_Entry.place(x=168, y=10, width=194, height=21)
        self.Projname_Entry_StringVar = StringVar()
        self.Projname_Entry.configure(
            textvariable=self.Projname_Entry_StringVar)
        self.Projname_Entry_StringVar.set("MyProject")

        self.Shortdesc_Entry = Entry(dialogframe, width="15")
        self.Shortdesc_Entry.place(x=72, y=150, width=688, height=48)
        self.Shortdesc_Entry_StringVar = StringVar()
        self.Shortdesc_Entry.configure(
            textvariable=self.Shortdesc_Entry_StringVar)
        self.Shortdesc_Entry_StringVar.set("My project does this")

        # Status must be correct format
        self.Status_Entry_StringVar = StringVar()
        self.Status_Entry = OptionMenu(dialogframe,
                                       self.Status_Entry_StringVar,
                                       *DEV_STATUS_OPTIONS)
        self.Status_Entry.place(x=228, y=451, width=183, height=21)
        self.Status_Entry_StringVar.set(DEV_STATUS_OPTIONS[0])

        self.Version_Entry = Entry(dialogframe, width="15")
        self.Version_Entry.place(x=552, y=451, width=184, height=21)
        self.Version_Entry_StringVar = StringVar()
        self.Version_Entry.configure(textvariable=self.Version_Entry_StringVar)
        self.Version_Entry_StringVar.set("0.1.1")

        self.Author_Label = Label(dialogframe, text="Author", width="15")
        self.Author_Label.place(x=96, y=424, width=112, height=22)

        self.Classname_Label = Label(dialogframe,
                                     text="Class Name",
                                     width="15")
        self.Classname_Label.place(x=60, y=73, width=112, height=22)

        self.Copyright_Label = Label(dialogframe, text="Copyright", width="15")
        self.Copyright_Label.place(x=96, y=478, width=113, height=23)

        self.Email_Label = Label(dialogframe, text="Email", width="15")
        self.Email_Label.place(x=96, y=505, width=113, height=23)

        self.GithubUserName_Label = Label(dialogframe,
                                          text="GithubUserName",
                                          width="15")
        self.GithubUserName_Label.place(x=96, y=539, width=113, height=23)

        self.Funcname_Label = Label(dialogframe,
                                    text="Function Name",
                                    width="15")
        self.Funcname_Label.place(x=60, y=100, width=112, height=22)

        self.License_Label = Label(dialogframe, text="License", width="15")
        self.License_Label.place(x=432, y=424, width=113, height=23)

        self.Longdesc_Label = Label(dialogframe,
                                    text="Paragraph Description",
                                    width="15")
        self.Longdesc_Label.place(x=216, y=220, width=376, height=22)

        self.Mainpyname_Label = Label(dialogframe,
                                      text="Main Python File",
                                      width="15")
        self.Mainpyname_Label.place(x=48, y=37, width=112, height=22)

        self.Projname_Label = Label(dialogframe,
                                    text="Project Name",
                                    width="15")
        self.Projname_Label.place(x=48, y=10, width=112, height=22)

        self.Selectdir_Label = Label(
            dialogframe,
            text="Select the Directory Below Which to Place Your Project",
            width="15")
        self.Selectdir_Label.place(x=156, y=567, width=536, height=24)

        self.Status_Label = Label(dialogframe, text="Status", width="15")
        self.Status_Label.place(x=96, y=451, width=114, height=24)

        self.Version_Label = Label(dialogframe, text="Version", width="15")
        self.Version_Label.place(x=432, y=451, width=113, height=23)

        self.Isclass_Radiobutton = Radiobutton(dialogframe,
                                               text="Class Project",
                                               value="Class Project",
                                               width="15",
                                               anchor=W)
        self.Isclass_Radiobutton.place(x=320, y=73, width=135, height=27)
        self.RadioGroup1_StringVar = StringVar()
        self.RadioGroup1_StringVar.set("Class Project")
        self.RadioGroup1_StringVar_traceName = \
            self.RadioGroup1_StringVar.trace_variable("w",
                                                      self.RadioGroup1_StringVar_Callback)
        self.Isclass_Radiobutton.configure(variable=self.RadioGroup1_StringVar)

        self.Isfunction_Radiobutton = Radiobutton(dialogframe,
                                                  text="Function Project",
                                                  value="Function Project",
                                                  width="15",
                                                  anchor=W)
        self.Isfunction_Radiobutton.place(x=320, y=100, width=135, height=27)
        self.Isfunction_Radiobutton.configure(
            variable=self.RadioGroup1_StringVar)

        lbframe = Frame(dialogframe)
        self.Text_1_frame = lbframe
        scrollbar = Scrollbar(lbframe, orient=VERTICAL)
        self.Text_1 = Text(lbframe,
                           width="40",
                           height="6",
                           yscrollcommand=scrollbar.set)
        scrollbar.config(command=self.Text_1.yview)
        scrollbar.pack(side=RIGHT, fill=Y)
        self.Text_1.pack(side=LEFT, fill=BOTH, expand=1)

        self.Text_1_frame.place(x=72, y=250, width=665, height=160)
        # >>>>>>insert any user code below this comment for section "top_of_init"

        self.dirname = '<Select Directory>'
        self.Funcname_Entry.config(state=DISABLED)

        h = Hatch(projName='MyProject', mainDefinesClass='N')
        if h.author:
            self.Author_Entry_StringVar.set(h.author)
        if h.proj_license:
            self.License_Entry_StringVar.set(h.proj_license)
        if h.proj_copyright:
            self.Copyright_Entry_StringVar.set(h.proj_copyright)
        if h.email:
            self.Email_Entry_StringVar.set(h.email)
        if h.github_user_name:
            self.GithubUserName_Entry_StringVar.set(h.github_user_name)
        del h

    def build_result_dict(self):
        """Takes user inputs from GUI and builds a dictionary of results"""
        # pylint: disable=W0201
        self.result = {}  # return a dictionary of results

        self.result["author"] = self.Author_Entry_StringVar.get()
        self.result["status"] = self.Status_Entry_StringVar.get()
        self.result["proj_license"] = self.License_Entry_StringVar.get()
        self.result["version"] = self.Version_Entry_StringVar.get()
        self.result["proj_copyright"] = self.Copyright_Entry_StringVar.get()
        self.result["email"] = self.Email_Entry_StringVar.get()
        self.result[
            "github_user_name"] = self.GithubUserName_Entry_StringVar.get()

        self.result["main_py_name"] = self.Mainpyname_Entry_StringVar.get()
        self.result["proj_name"] = self.Projname_Entry_StringVar.get()
        self.result["class_name"] = self.Classname_Entry_StringVar.get()
        self.result["func_name"] = self.Funcname_Entry_StringVar.get()

        self.result["short_desc"] = self.Shortdesc_Entry_StringVar.get()
        self.result["para_desc"] = self.Text_1.get(1.0, END)
        self.result["parent_dir"] = self.dirname

        if self.RadioGroup1_StringVar.get() == "Class Project":
            self.result["is_class_project"] = 'Y'
        else:
            self.result["is_class_project"] = 'N'

    def Buildproject_Button_Click(self, event):
        """When clicked, this method gathers all the user inputs
            and builds the project skeleton in the directory specified.
        """

        #  tkinter requires arguments, but I don't use them
        # pylint: disable=W0613

        # >>>>>>insert any user code below this comment for section "compID=29"
        # replace, delete, or comment-out the following
        #print "executed method Buildproject_Button_Click"

        if not os.path.isdir(self.dirname):
            ShowError(
                title='Need Parent Directory',
                message=
                'You need to choose a directory in which to place your project.'
            )
        else:
            self.build_result_dict()  # builds self.result dict
            r = self.result

            h = Hatch(projName=r["proj_name"],
                      mainDefinesClass=r["is_class_project"],
                      mainPyFileName=r["main_py_name"],
                      mainClassName=r["class_name"],
                      mainFunctionName=r["func_name"],
                      author=r["author"],
                      proj_copyright=r["proj_copyright"],
                      proj_license=r["proj_license"],
                      version=r["version"],
                      email=r["email"],
                      status=r["status"],
                      github_user_name=r["github_user_name"],
                      simpleDesc=r["short_desc"],
                      longDesc=r["para_desc"])

            call_result = h.save_project_below_this_dir(self.dirname)
            if call_result == 'Success':
                if AskYesNo(title='Exit Dialog',
                            message='Do you want to leave this GUI?'):
                    self.master.destroy()
            else:
                ShowWarning( title='Project Build Error',
                             message='Project did NOT build properly.\n'+\
                            'Warning Message = (%s)'%call_result)

    # return a string containing directory name
    def AskDirectory(self, title='Choose Directory', initialdir="."):
        """Simply wraps the tkinter function of the "same" name."""
        dirname = tkFileDialog.askdirectory(parent=self.master,
                                            initialdir=initialdir,
                                            title=title)
        return dirname  # <-- string

    def Selectdir_Button_Click(self, event):
        #  I don't care what the exception is, if there's a problem, bail
        #     Also, I want to redefine the dirname attribute here
        # pylint: disable=W0702, W0201

        #  tkinter requires arguments, but I don't use them
        # pylint: disable=W0613
        """Selects the directory in which to build project."""

        dirname = self.AskDirectory(title='Choose Directory For Nose Tests',
                                    initialdir='.')
        if dirname:
            try:
                dirname = os.path.abspath(dirname)
            except:
                self.dirname = '<Select Directory>'
                return  # let Alarm force dir selection

            self.dirname = dirname

            self.Selectdir_Button.config(text=self.dirname)

    def RadioGroup1_StringVar_Callback(self, varName, index, mode):
        #  tkinter requires arguments, but I don't use them
        # pylint: disable=W0613
        """Responds to changes in RadioGroup1_StringVar."""
        if self.RadioGroup1_StringVar.get() == "Class Project":
            self.Funcname_Entry.config(state=DISABLED)
            self.Classname_Entry.config(state=NORMAL)
        else:
            self.Classname_Entry.config(state=DISABLED)
            self.Funcname_Entry.config(state=NORMAL)

    # tk_happy generated code. DO NOT EDIT THE FOLLOWING. section "Master_Configure"
    def bindConfigure(self, event):
        """bindConfigure and Master_Configure help stabilize GUI"""
        #  tkinter requires arguments, but I don't use them
        # pylint: disable=W0613
        if not self.initComplete:
            self.master.bind("<Configure>", self.Master_Configure)
            self.initComplete = 1

    def Master_Configure(self, event):
        """bindConfigure and Master_Configure help stabilize GUI"""
        # >>>>>>insert any user code below this comment for section "Master_Configure"
        # replace, delete, or comment-out the following
        if event.widget != self.master:
            if self.w != -1:
                return
        x = int(self.master.winfo_x())
        y = int(self.master.winfo_y())
        w = int(self.master.winfo_width())
        h = int(self.master.winfo_height())
        if (self.x, self.y, self.w, self.h) == (-1, -1, -1, -1):
            self.x, self.y, self.w, self.h = x, y, w, h

        if self.w != w or self.h != h:
            print "Master reconfigured... make resize adjustments"
            self.w = w
            self.h = h
Beispiel #11
0
    def initUI(self):
        """
        Initializes the user interface

        Setting up the entry widgets for:
        - Experiment_ID
        - Participant Name
        - Session Day
        - Pupil Size
        - Practice
        - Stereo
        """
        # Set the title
        self.parent.title(EXP_NAME)

        # Create the label for Experiment_ID and set location
        label_id = Label(text='Participant ID:')
        label_id.place(x=20, y=20)

        # Check the DATA_DIR directory for previous participants
        # and choose the next Experiment_ID in line
        self.folders = listdir(DATA_DIR)
        # Initiate Tkinter's StringVar
        self.value_id = StringVar()
        # Set the default value
        self.value_id.set('001')
        # Going in reverse order of the participants' directories in
        # DATA_DIR, find the last participant's Experiment_ID and opt
        # for the next one in line
        for folder in reversed(self.folders):
            try:
                # Check if the value of the first 3 digits of the
                # directory name is greater than the default value
                if int(folder[:3]) >= int(self.value_id.get()):
                    # Get the next Experiment_ID in integer form and
                    # convert to string format
                    num = str(int(folder[:3]) + 1)
                    # Actions to perform in case scenarios for each
                    # of the possibilites of num_length
                    num_length = {
                                  3: num,
                                  2: '0%s' % num,
                                  1: '00%s' % num
                    }
                    # Set the value accordingly to the StringVar,
                    # replacing the default
                    self.value_id.set(num_length[len(num)])
            # In case there are other folders in DATA_DIR, for which
            # the first 3 characters are not digits, we must cater
            # for when an exception is thrown up
            except ValueError:
                pass
        # Create the entry widget for Experiment_ID with the preset
        # value and state disabled
        self.input_id = Entry(self.parent, width=5, state=DISABLED,
                              textvariable=self.value_id)
        self.input_id.place(x=150, y=20)

        # Create the label for Participant Name and set location
        label_name = Label(text='Participant Name:')
        label_name.place(x=20, y=50)

        # Initiate Tkinter's StringVar
        self.value_name = StringVar()
        # Set the default value
        self.value_name.set('')
        # Create the entry for Participant Name and set location
        self.input_name = Entry(self.parent, width=35,
                                textvariable=self.value_name)
        self.input_name.place(x=150, y=50)
        self.input_name.focus()

        # Create the label for Session Day and set location
        label_day = Label(text='Session Day:')
        label_day.place(x=20, y=80)

        # Create value holder for Session Day as IntVar and set default
        # value to 1
        self.value_day = IntVar()
        self.value_day.set(1)
        # Create the radiobuttons as required
        for day in range(1, TOTAL_SESSIONS + 1):
            input_day = Radiobutton(self.parent, text=str(day),
                                    variable=self.value_day, value=day)
            # Anchor them to the West (W)
            input_day.pack(anchor=W)
            # Choose location for the radiobuttons
            input_day.place(x=150, y=(50 + (day * 25)))

        # Create the label for Pupil Size and set location
        label_pupilsize = Label(text='Pupil Size:')
        label_pupilsize.place(x=20, y=140)

        self.value_pupilsize = StringVar()
        self.value_pupilsize.set('')
        # Create the MaxLengthEntry for Pupil Size and set location
        # The maximum length is set to 3 characters and a float must be
        # provided
        self.input_pupilsize = MaxLengthEntry(self.parent, width=5,
                                              maxlength=3,
                                              required_type=float)
        self.input_pupilsize.config(textvariable=self.value_pupilsize)
        self.input_pupilsize.place(x=150, y=140)

        # Create value folder for Practice as IntVar
        self.value_practice = IntVar()
        # Create the checkbutton for Practice and set location
        input_practice = Checkbutton(self.parent, text='Practice',
                                     variable=self.value_practice, onvalue=1,
                                     offvalue=0)
        input_practice.place(x=150, y=170)

        # Create value holder for Stereo as IntVar
        self.value_stereo = IntVar()
        # Create the checkbutton for Stereo and set location
        input_stereo = Checkbutton(self.parent, text='Stereo',
                                   variable=self.value_stereo, onvalue=1,
                                   offvalue=0)
        input_stereo.place(x=150, y=200)

        # Create the label for Previous Subjects and set location
        label_previous = Label(text='Previous Subjects:')
        label_previous.place(x=20, y=250)

        # Create the Listboc containing all the previous participants
        self.input_previous = Listbox(self.parent, width=35, height=10)
        for identifier in self.folders:
            self.input_previous.insert(END, identifier)
        self.input_previous.place(x=150, y=250)
        self.input_previous.bind('<<ListboxSelect>>', self.__select_previous)

        # Create the submit button, give command upon pressing and set
        # location
        submit = Button(text='Submit', width=47, command=self.gather_input)
        submit.pack(padx=8, pady=8)
        submit.place(x=20, y=425)
Beispiel #12
0
class CHEOBCMAKiosk:
    def __init__(self, top=None):
        ' "It is a good habit, when building any type of GUI component, to keep a reference to our parent" '
        self.top = top
        top.geometry("600x450+525+240")
        top.title("CHEO BCMA KIOSK")
        top.configure(background="#d9d9d9")
        top.configure(highlightbackground="#d9d9d9")
        top.configure(highlightcolor="black")
        '''------------------------------------------------------------------------------------------------------
        Begin Build Text Box '''
        self.TextBox = Text(top)
        self.TextBox.place(relx=0.2, rely=0.15, relheight=0.34, relwidth=0.64)
        self.TextBox.configure(background="white")
        self.TextBox.configure(borderwidth="2")
        self.TextBox.configure(highlightbackground="#d9d9d9")
        self.TextBox.configure(highlightcolor="black")
        self.TextBox.configure(relief=RIDGE)
        self.TextBox.configure(takefocus="no")
        ' Bind mouse clicks '
        self.TextBox.bind("<Button-1>", self.textbox_text)
        self.TextBox.bind("<Button-2>", self.textbox_text)
        self.TextBox.bind("<Button-3>", self.textbox_text)
        ' Initial value '
        self.TextBox.insert(END, "This is the initial text.")
        ' Disable content from user entry '
        self.TextBox.config(state=DISABLED)

        self.LabelTitle = Label(top)
        self.LabelTitle.place(relx=0.03, rely=0.03, height=19, width=311)
        self.LabelTitle.configure(activebackground="#f9f9f9")
        self.LabelTitle.configure(activeforeground="black")
        self.LabelTitle.configure(background="#d9d9d9")
        self.LabelTitle.configure(disabledforeground="#a3a3a3")
        self.LabelTitle.configure(foreground="#000000")
        self.LabelTitle.configure(highlightbackground="#d9d9d9")
        self.LabelTitle.configure(highlightcolor="black")
        self.LabelTitle.configure(
            text=
            '''Welcome to the CHEO self-serve BCMA employee barcode kiosk''')
        ''' End Build Canvas
        ------------------------------------------------------------------------------------------------------'''
        ''' Build Buttons
        ------------------------------------------------------------------------------------------------------'''
        # Print Button
        self.ButtonPrint = Button(top)
        self.ButtonPrint.configure(command=self.printBut)
        self.ButtonPrint.place(relx=0.42, rely=0.89, height=21, width=31)
        self.ButtonPrint.configure(text='''Print''')
        self.ButtonPrint.configure(underline="0")
        self.ButtonPrint.configure(default='active')
        self.ButtonPrint.configure(takefocus='Yes')
        # Close Button
        self.ButtonClose = Button(top)
        self.ButtonClose.configure(command=quit)
        self.ButtonClose.place(relx=0.55, rely=0.89, height=21, width=35)
        self.ButtonClose.configure(activebackground="#d9d9d9")
        self.ButtonClose.configure(activeforeground="#000000")
        self.ButtonClose.configure(background="#d9d9d9")
        self.ButtonClose.configure(disabledforeground="#a3a3a3")
        self.ButtonClose.configure(foreground="#000000")
        self.ButtonClose.configure(highlightbackground="#d9d9d9")
        self.ButtonClose.configure(highlightcolor="black")
        self.ButtonClose.configure(pady="0")
        self.ButtonClose.configure(text='''Close''')
        self.ButtonClose.configure(underline="0")
        ''' End Build Buttons
        ------------------------------------------------------------------------------------------------------'''
        ''' Begin Build Radio Group
        ------------------------------------------------------------------------------------------------------'''
        # Default Radio Button Source to TAP
        self.input_source = StringVar()
        self.input_source.set('TAP')

        # Tap Data Entry Radio
        self.rdo_TAP = Radiobutton(top)
        self.rdo_TAP.place(relx=0.8, rely=0.82, relheight=0.05, relwidth=0.14)
        self.rdo_TAP.configure(activebackground="#d9d9d9")
        self.rdo_TAP.configure(activeforeground="#000000")
        self.rdo_TAP.configure(background="#d9d9d9")
        self.rdo_TAP.configure(disabledforeground="#a3a3a3")
        self.rdo_TAP.configure(foreground="#000000")
        self.rdo_TAP.configure(highlightbackground="#d9d9d9")
        self.rdo_TAP.configure(highlightcolor="black")
        self.rdo_TAP.configure(justify=LEFT)
        self.rdo_TAP.configure(text='Tap Reader')
        self.rdo_TAP.configure(underline="0")
        self.rdo_TAP.configure(value='TAP')
        self.rdo_TAP.configure(variable=self.input_source)
        self.rdo_TAP.configure(command=self.radio_toggle)
        # Manual Data Entry Radio
        self.rdo_MAN = Radiobutton(top)
        self.rdo_MAN.place(relx=0.8, rely=0.89, relheight=0.05, relwidth=0.15)
        self.rdo_MAN.configure(activebackground="#d9d9d9")
        self.rdo_MAN.configure(activeforeground="#000000")
        self.rdo_MAN.configure(background="#d9d9d9")
        self.rdo_MAN.configure(disabledforeground="#a3a3a3")
        self.rdo_MAN.configure(foreground="#000000")
        self.rdo_MAN.configure(highlightbackground="#d9d9d9")
        self.rdo_MAN.configure(highlightcolor="black")
        self.rdo_MAN.configure(justify=LEFT)
        self.rdo_MAN.configure(text='Manual Entry')
        self.rdo_MAN.configure(underline="0")
        self.rdo_MAN.configure(value="MAN")
        self.rdo_MAN.configure(variable=self.input_source)
        self.rdo_MAN.configure(command=self.radio_toggle)
        ''' End Build Radio Group
        ------------------------------------------------------------------------------------------------------'''
        ''' Begin Fixed Labels
        ------------------------------------------------------------------------------------------------------'''
        # Last Name
        self.LabelLastName = Label(top)
        self.LabelLastName.place(relx=0.1, rely=0.56, height=19, width=56)
        self.LabelLastName.configure(activebackground="#f9f9f9")
        self.LabelLastName.configure(activeforeground="black")
        self.LabelLastName.configure(background="#d9d9d9")
        self.LabelLastName.configure(disabledforeground="#a3a3a3")
        self.LabelLastName.configure(foreground="#000000")
        self.LabelLastName.configure(highlightbackground="#d9d9d9")
        self.LabelLastName.configure(highlightcolor="black")
        self.LabelLastName.configure(text='''Last Name''')
        # First Name
        self.LabelFirstName = Label(top)
        self.LabelFirstName.place(relx=0.1, rely=0.62, height=19, width=57)
        self.LabelFirstName.configure(activebackground="#f9f9f9")
        self.LabelFirstName.configure(activeforeground="black")
        self.LabelFirstName.configure(background="#d9d9d9")
        self.LabelFirstName.configure(disabledforeground="#a3a3a3")
        self.LabelFirstName.configure(foreground="#000000")
        self.LabelFirstName.configure(highlightbackground="#d9d9d9")
        self.LabelFirstName.configure(highlightcolor="black")
        self.LabelFirstName.configure(text='''First Name''')
        # AD User Name
        self.LabelADUserName = Label(top)
        self.LabelADUserName.place(relx=0.07, rely=0.69, height=19, width=75)
        self.LabelADUserName.configure(activebackground="#f9f9f9")
        self.LabelADUserName.configure(activeforeground="black")
        self.LabelADUserName.configure(background="#d9d9d9")
        self.LabelADUserName.configure(disabledforeground="#a3a3a3")
        self.LabelADUserName.configure(foreground="#000000")
        self.LabelADUserName.configure(highlightbackground="#d9d9d9")
        self.LabelADUserName.configure(highlightcolor="black")
        self.LabelADUserName.configure(text='''AD User Name''')
        # AD Password
        self.LabelADPassword = Label(top)
        self.LabelADPassword.place(relx=0.08, rely=0.76, height=19, width=70)
        self.LabelADPassword.configure(activebackground="#f9f9f9")
        self.LabelADPassword.configure(activeforeground="black")
        self.LabelADPassword.configure(background="#d9d9d9")
        self.LabelADPassword.configure(disabledforeground="#a3a3a3")
        self.LabelADPassword.configure(foreground="#000000")
        self.LabelADPassword.configure(highlightbackground="#d9d9d9")
        self.LabelADPassword.configure(highlightcolor="black")
        self.LabelADPassword.configure(text='''AD Password''')
        ''' End Fixed Labels
        ------------------------------------------------------------------------------------------------------'''
        ''' Begin Data Entry
        ------------------------------------------------------------------------------------------------------'''
        # Last Name
        self.EntryLastName = Entry(top)
        self.EntryLastName.place(relx=0.2,
                                 rely=0.56,
                                 relheight=0.04,
                                 relwidth=0.34)
        self.EntryLastName.configure(background="white")
        self.EntryLastName.configure(disabledforeground="#a3a3a3")
        self.EntryLastName.configure(font="TkFixedFont")
        self.EntryLastName.configure(foreground="#000000")
        self.EntryLastName.configure(highlightbackground="#d9d9d9")
        self.EntryLastName.configure(highlightcolor="black")
        self.EntryLastName.configure(insertbackground="black")
        self.EntryLastName.configure(selectbackground="#c4c4c4")
        self.EntryLastName.configure(selectforeground="black")
        ' Bind mouse clicks '
        self.EntryLastName.bind("<Button-1>", self.lastname_text)
        self.EntryLastName.bind("<Button-2>", self.lastname_text)
        self.EntryLastName.bind("<Button-3>", self.lastname_text)
        'self.EntryLastName.configure(state=readonly)'
        ' First Name '
        self.EntryFirstName = Entry(top)
        self.EntryFirstName.place(relx=0.2,
                                  rely=0.62,
                                  relheight=0.04,
                                  relwidth=0.34)
        self.EntryFirstName.configure(background="white")
        self.EntryFirstName.configure(disabledforeground="#a3a3a3")
        self.EntryFirstName.configure(font="TkFixedFont")
        self.EntryFirstName.configure(foreground="#000000")
        self.EntryFirstName.configure(highlightbackground="#d9d9d9")
        self.EntryFirstName.configure(highlightcolor="black")
        self.EntryFirstName.configure(insertbackground="black")
        self.EntryFirstName.configure(selectbackground="#c4c4c4")
        self.EntryFirstName.configure(selectforeground="black")
        '''self.EntryFirstName.configure(label="Hi There")
        readonly = 'readonly'
        self.EntryFirstName.configure(state=readonly)'''
        ' AD User Name '
        self.EntryADUserName = Entry(top)
        self.EntryADUserName.place(relx=0.2,
                                   rely=0.69,
                                   relheight=0.04,
                                   relwidth=0.34)
        self.EntryADUserName.configure(background="white")
        self.EntryADUserName.configure(disabledforeground="#a3a3a3")
        self.EntryADUserName.configure(font="TkFixedFont")
        self.EntryADUserName.configure(foreground="#000000")
        self.EntryADUserName.configure(highlightbackground="#d9d9d9")
        self.EntryADUserName.configure(highlightcolor="black")
        self.EntryADUserName.configure(insertbackground="black")
        self.EntryADUserName.configure(selectbackground="#c4c4c4")
        self.EntryADUserName.configure(selectforeground="black")
        readonly = 'readonly'
        self.EntryADUserName.configure(state=readonly)
        ' Data Payload '
        self.EntryADPassword = Entry(top)
        self.EntryADPassword.place(relx=0.2,
                                   rely=0.76,
                                   relheight=0.04,
                                   relwidth=0.34)
        self.EntryADPassword.configure(background="white")
        self.EntryADPassword.configure(disabledforeground="#a3a3a3")
        self.EntryADPassword.configure(font="TkFixedFont")
        self.EntryADPassword.configure(foreground="#000000")
        self.EntryADPassword.configure(highlightbackground="#d9d9d9")
        self.EntryADPassword.configure(highlightcolor="black")
        self.EntryADPassword.configure(insertbackground="black")
        self.EntryADPassword.configure(selectbackground="#c4c4c4")
        self.EntryADPassword.configure(selectforeground="black")
        '''readonly = 'readonly'
        self.EntryADPassword.configure(state=readonly)'''
        ''' End Data Entry Fields
        ------------------------------------------------------------------------------------------------------'''
        ''' Begin Status Bar
        ------------------------------------------------------------------------------------------------------'''
        # Create a sunken status bar in the root object with a border
        self.status_text = StringVar()  # Displays live status
        self.status_text.set("Hello")
        self.status = Label(root,
                            textvariable=self.status_text,
                            bd=1,
                            relief=SUNKEN,
                            anchor=W)  # anchor to the West (Left)
        self.status.pack(side=BOTTOM, fill=X)  # display
        ''' End Status Bar
        ------------------------------------------------------------------------------------------------------'''

    ' Print Button Function'

    def printBut(self):
        ' Instantiate ZPLII Class '
        ' ??? @@@ '
        print('Print button has been pressed')
        print('Current values... ' + str(self.EntryFirstName))
        self.status = "Q"
        # self.input_source.set(_self.input_source.Get)

    def radio_toggle(self):
        ' @@@ '
        selection = self.input_source.get()
        print('Radio button is ' + selection)
        self.status_text.set("Radio toggled to " + selection)

    def textbox_text(self, event):
        print('Text Box Event - ' + str(event))
        ' Enable before insert '
        if self.TextBox["state"] == DISABLED:
            self.TextBox.config(state=NORMAL)
        self.TextBox.insert(END, "\nMouse click in TextBox")
        ' Disable after insert '
        self.TextBox.config(state=DISABLED)

    def lastname_text(self, event):
        print('LastName Entry Event - ' + str(event))
        ' Enable before insert '
        if self.TextBox["state"] == DISABLED:
            self.TextBox.config(state=NORMAL)
        self.TextBox.insert(END, "\nMouse click in Last Name field")
        ' Disable after insert '
        self.TextBox.config(state=DISABLED)
        ' Update status depending on which button pressed '
        if event.num == 1:
            self.status_text.set("Left button clicked")
        elif event.num == 2:
            self.status_text.set("Middle button clicked")
        elif event.num == 3:
            self.status_text.set("Right button clicked")
        else:
            self.status_text.set("*** The " + str(event.num) +
                                 " button pressed ***")
	def inputinfo(self):
		tabControl=ttk.Notebook(self.window)

		match=ttk.Frame(tabControl,width=450,height=328)
		tabControl.add(match,text=' -Match- ')

		battle=ttk.Frame(tabControl,width=450,height=328)
		tabControl.add(battle,text=' -Fight- ')

		scene=ttk.Frame(tabControl,width=450,height=328)
		tabControl.add(scene,text=' -Round- ')

		tabControl.place(x=20,y=180)

		#Match Info
		num=Message(match,text='Game No.',width=70)
		num.place(x=10,y=10)

		self.num_entry=Entry(match,width=6,textvariable=self.MATCH.gameNum)
		self.num_entry.place(x=80,y=10)


		mapName=Message(match,text='Map:',width=50)
		mapName.place(x=130,y=10)

		self.mapName_cb=ttk.Combobox(match,width=10,textvariable=self.MATCH.mapNum)
		self.mapName_cb['values']=mapList
		self.mapName_cb.place(x=180,y=10)

		time=Message(match,text='Duration:',width=100)
		time.place(x=280,y=10)

		self.time_entry=Entry(match,width=10,textvariable=self.MATCH.gameTime)
		self.time_entry.place(x=350,y=10)

		def selectTeamA(*args):			
			team_selected=teamA_cb.current()
			y=20

			for i in range(0,6):
				self.ap.insert(i,ttk.Combobox(teamA_frame,width=10))
				print self.ap[i]
				self.ap[i]['values']=allPlayers.get(teamList[team_selected],' ')
				name='Player'+str(i+1)
				self.ap[i].insert(0,name)
				self.ap[i].place(x=10,y=y+20*(i+1))
			for i in range(0,6):
				self.ah.insert(i,ttk.Combobox(teamA_frame,width=10))
				self.ah[i]['values']=heroList
				name='hero'
				self.ah[i].insert(0,name)
				self.ah[i].place(x=105,y=y+20*(i+1))
		def selectTeamB(*args):
			team_selected=teamB_cb.current()
			y=20
			for i in range(0,6):
				self.bp.insert(i,ttk.Combobox(teamB_frame,width=10))
				self.bp[i]['values']=allPlayers.get(teamList[team_selected],' ')
				name='Player'+str(i+7)
				self.bp[i].insert(0,name)
				self.bp[i].place(x=10,y=y+20*(i+1))
			for i in range(0,6):
				self.bh.insert(i,ttk.Combobox(teamB_frame,width=10))
				self.bh[i]['values']=heroList
				name='hero'
				self.bh[i].insert(0,name)
				self.bh[i].place(x=105,y=y+20*(i+1))

		#Team A information
		teamA_frame=LabelFrame(match,text='TeamA',width=210,height=200)
		teamA_frame.place(x=10,y=50)

		teamA_name=Message(teamA_frame,text='Name:',width=70)
		teamA_name.place(x=10,y=10)

		teamA_cb=ttk.Combobox(teamA_frame,width=12,textvariable=self.MATCH.teamA)
		teamA_cb['values']=teamList
		teamA_cb.bind('<<ComboboxSelected>>',selectTeamA)
		teamA_cb.place(x=60,y=10)

		#Team B information
		teamB_frame=LabelFrame(match,text='TeamB',width=210,height=200)
		teamB_frame.place(x=230,y=50)

		teamB_name=Message(teamB_frame,text='Name:',width=70)
		teamB_name.place(x=10,y=10)

		teamB_cb=ttk.Combobox(teamB_frame,width=12,textvariable=self.MATCH.teamB)
		teamB_cb['values']=teamList
		teamB_cb.bind('<<ComboboxSelected>>',selectTeamB)
		teamB_cb.place(x=60,y=10)

		self.A=teamA_cb
		self.B=teamB_cb

		winner=Message(match,text='Match Winner:',width=150)
		winner.place(x=10,y=260)
		self.winteam=IntVar()
		if self.MATCH.finalwinner == 'A':
			self.winteam.set(1)
		if self.MATCH.finalwinner == 'B':
			self.winteam.set(2)
		winA=Radiobutton(match,text='TeamA',variable=self.winteam,value=1)
		winB=Radiobutton(match,text='TeamB',variable=self.winteam,value=2)
		winA.place(x=110,y=260)
		winB.place(x=180,y=260)

		attacker=Message(match,text='First Attack:',width=150)
		attacker.place(x=10,y=280)
		
		self.attackteam=IntVar()
		if self.MATCH.attack == 'A':
			self.attackteam.set(1)
		if self.MATCH.attack == 'B':
			self.attackteam.set(2)
		attackA=Radiobutton(match,text='TeamA',variable=self.attackteam,value=1)
		attackB=Radiobutton(match,text='TeamB',variable=self.attackteam,value=2)
		attackA.place(x=110,y=280)
		attackB.place(x=180,y=280)

		matchSave=Button(match,text='Save',width=10,command=self.savematch)
		matchSave.place(x=330,y=290)

		#Battle Info
		battle_label=Label(battle,textvariable=self.BATTLE.caption,width=15,height=1)
		battle_label.place(x=0,y=20)

		start_tag=Label(battle,text='Start time:',foreground='black',width=8,height=1)
		start_tag.place(x=100,y=10)

		self.start_entry=Entry(battle,width=20,textvariable=self.BATTLE.start_time,foreground='black')
		self.start_entry.place(x=200,y=10)

		end_tag=Label(battle,text='End time:',foreground='black',width=8,height=1)
		end_tag.place(x=100,y=40)

		self.end_entry=Entry(battle,width=20,textvariable=self.BATTLE.end_time,foreground='black')
		self.end_entry.place(x=200,y=40)

		#winner
		win_tag=Label(battle,text='Fight Winner:',foreground='black',width=10,height=1) #标签
		win_tag.place(x=100,y=70)

		self.team=IntVar()
		self.team.set(1)
		team1=Radiobutton(battle,text='Team A',variable=self.team,value=1)
		team1.place(x=200,y=70)
		team2=Radiobutton(battle,text='Team B',variable=self.team,value=2)
		team2.place(x=270,y=70)

		next_button=Button(battle,text='Next',width=10,command=self.battlenext)
		next_button.place(x=100,y=100)

		alter_tag=Label(battle,text='Input fight number to alter information:') #标签
		alter_tag.place(x=30,y=150)

		self.alter_entry=Entry(battle,width=5)
		self.alter_entry.place(x=280,y=150)

		alter_button=Button(battle,text='Go',width=7,command=self.fightalter)
		alter_button.place(x=330,y=150)

		battleSave=Button(battle,text='Save',width=10,command=self.savefight)
		battleSave.place(x=330,y=290)

		#Round Info
		round_label=Label(scene,textvariable=self.ROUND.caption,width=15,height=1)
		round_label.place(x=0,y=20)

		sstart_tag=Label(scene,text='Start time:',foreground='black',width=8,height=1)
		sstart_tag.place(x=100,y=10)

		self.sstart_entry=Entry(scene,width=20,textvariable=self.ROUND.start_time,foreground='black')
		self.sstart_entry.place(x=200,y=10)

		send_tag=Label(scene,text='End time:',foreground='black',width=8,height=1)
		send_tag.place(x=100,y=40)

		self.send_entry=Entry(scene,width=20,textvariable=self.ROUND.end_time,foreground='black')
		self.send_entry.place(x=200,y=40)

		snext_button=Button(scene,text='Next',width=10,command=self.roundnext)
		snext_button.place(x=100,y=100)

		salter_tag=Label(scene,text='Input battle number to alter information:') #标签
		salter_tag.place(x=30,y=150)

		self.salter_entry=Entry(scene,width=5)
		self.salter_entry.place(x=280,y=150)

		salter_button=Button(scene,text='Go',width=7,command=self.roundalter)
		salter_button.place(x=330,y=150)

		sceneSave=Button(scene,text='Save',width=10,command=self.saveround)
		sceneSave.place(x=330,y=290)