Esempio n. 1
0
    def about(self):
        """
        makes simple GUI of About window
        """
        window = "about_window"
        ok_hover_bg = cf.get(window, "ok_hover_bg")
        ok_default_bg = cf.get(window, "ok_default_bg")
        font = Font(family=self.font_family, size=10)

        #main frame
        top = Toplevel(self)
        top.resizable(FALSE, FALSE)
        top.title("About " + self.title)
        top.wm_iconbitmap(bitmap=cf.get(window, "icon_file"))

        #info frame in main frame
        frame = Frame(top, relief=SUNKEN, bg="white", borderwidth=1)

        Label(frame, text="Voice Analyzer. Simple program for speech recognition, created for qualification work",
              bg="white", font=font).pack(padx=5, pady=5)
        Label(frame, text="Copyright " + self.copyright_year + ". GNU License. All rights reserved.",
              bg="white", font=font).pack(padx=5, pady=5)

        #author
        link_info = Message(frame, text="Author: " + self.author, bg="white", font=font, width=250)
        link_info.pack(side=LEFT, anchor=E, padx=5, pady=5)

        #link to author page (somewhere)
        link = Label(frame, text="Google Plus", bg="white", fg=self.link_color, font=font, cursor=self.link_cursor)
        link.bind("<Button-1>", lambda x: webbrowser.open_new_tab(self.author_google_plus))
        link.pack(side=LEFT, anchor=S, pady=5)
        frame.pack()

        #OK button in main frame
        button = Button(top, text="OK", command=top.destroy, width=10, bg=ok_default_bg, borderwidth=1)
        button.bind("<Enter>", lambda event, h=button: self.change_bg(h, ok_hover_bg))
        button.bind("<Leave>", lambda event, h=button: self.change_bg(h, ok_default_bg))
        button.pack(side=RIGHT, anchor=S, padx=5, pady=5)
Esempio n. 2
0
    def __init__(self, root):
        Frame.__init__(self, root)

        #========================================================================
        # Fast Fourier Transform
        self.processor = FFTVoiceAnalyzer(path_to_examples, np.fft.fft, WavFile(path_to_silence))
        # Fast Fourier Transform
        #========================================================================

        #========================================================================
        # Naive Bayes Classifier
        self.nbc = NBC()
        self.nbc.initialize()
        # Naive Bayes Classifier
        #========================================================================

        #========================================================================
        # SPro 5 (MFCC classifierd)
        self.s = SPro5()
        self.s.learn()
        # SPro 5 (MFCC classifierd)
        #========================================================================

        #get general properties
        self.title = cf.get("general", "title")
        self.author = cf.get("general", "author")
        self.link_color = cf.get("general", "link_color")
        self.link_cursor = cf.get("general", "link_cursor")
        self.font_family = cf.get("general", "font_family")
        self.author_email = cf.get("general", "author_email")
        self.copyright_year = cf.get("general", "copyright_year")
        self.author_google_plus = cf.get("general", "author_google_plus")
        self.license_agree_link = cf.get("general", "license_agree_link")
        #get general properties

        #get program properties
        self.min_audio_time = int(cf.get("program", "min_audio_time"))
        self.max_audio_time = int(cf.get("program", "max_audio_time"))
        self.default_audio_time = int(cf.get("program", "default_audio_time"))
        self.min_test_audio_time = int(cf.get("program", "min_test_audio_time"))
        self.max_test_audio_time = int(cf.get("program", "max_test_audio_time"))
        self.default_test_audio_time = int(cf.get("program", "default_test_audio_time"))
        #get program properties

        self.root = root
        self.root.title(self.title)
        self.root.resizable(FALSE, FALSE)
        self.root.protocol("WM_DELETE_WINDOW", self.close)
        root.wm_iconbitmap(bitmap=cf.get("main_window", "icon_file"))

        self.top_frame = None
        self.main_frame = None
        self.bottom_frame = None

        self.init_ui()
        self.pack()