예제 #1
0
    def __init__(self):
        """Sets up the window"""
        EasyFrame.__init__(self,
                           title="MP3 File Rename",
                           background="#FDEADB",
                           resizable=False)
        EasyFrame.addLabel(self,
                           text="Welcome!",
                           font=("Verdana", 50, "italic"),
                           background="#FDEADB",
                           row=1,
                           column=1)

        # Label and field for directory path.
        EasyFrame.addLabel(
            self,
            text=
            "Please enter the path of the directory containing files to rename:",
            background="#FDEADB",
            row=2,
            column=1)
        self.directory = EasyFrame.addTextField(self,
                                                text="",
                                                width=100,
                                                row=3,
                                                column=1)
        self.directory.bind("<KeyPress-Return>", lambda event: self.rename())

        # Label and radio button options.
        EasyFrame.addLabel(self,
                           text="What naming scheme would you like to use?",
                           background="#FDEADB",
                           row=4,
                           column=1)
        self.statusGroup = EasyFrame.addRadiobuttonGroup(self, row=5, column=1)
        self.trackTitleAlbum = defaultRB = self.statusGroup.addRadiobutton(
            "Track Number - Title - Album.mp3")
        self.titleAlbum = self.statusGroup.addRadiobutton("Title - Album.mp3")
        self.albumTrackTitle = self.statusGroup.addRadiobutton(
            "Album - Track Number - Title.mp3")
        self.artistTitleAlbum = self.statusGroup.addRadiobutton(
            "Artist - Title - Album.mp3")
        self.artistTitle = self.statusGroup.addRadiobutton(
            "Artist - Title.mp3")
        self.statusGroup.setSelectedButton(defaultRB)

        # The rename Button.
        EasyFrame.addButton(self,
                            text="Rename Now!",
                            row=6,
                            column=1,
                            command=self.rename)

        # Output text field.
        self.process = EasyFrame.addTextArea(self,
                                             text="",
                                             row=7,
                                             column=1,
                                             width=50,
                                             height=20)