Пример #1
0
        def onObjectClick(self, event): 
                """function to get movie details on the movie when clicked."""
                

                tempMovie = Movie(2, 4, "132")
                tempMovie = tempMovie.getMovieByOvalId(event.widget.find_closest(event.x, event.y)[0], self.moviesList)

                # get id's of the artists starring in this movie
                artistmovierelation = ArtistMovieRelation(0,0)
                artistStarring = artistmovierelation.getArtistsByMovieId(tempMovie.getMovieId(), self.relationsList)

                tempActor = Actor("","")
                tempActress = Actress("","")

                # fetches the name of the actor or actress. finds out whether it originated from tbe actor or actress class.

                artistsStartingNames = []
                for artistId in artistStarring:
                        actor = tempActor.getArtistByid(artistId, self.actorsList)
                        if actor != None:
                                artistsStartingNames.append(actor.getArtistName())
                        else:
                                actress = tempActress.getArtistByid(artistId, self.actressesList)
                                if actress != None:
                                        artistsStartingNames.append(actress.getArtistName())

                #  labels to show the film details
                self.movieDetailsVar.set('Title of the Film   : ' + tempMovie.getMovieTitle() + "\n" + "\n" 
                                         "Year Film Released : " + tempMovie.getMovieYear() + "\n"+ "\n" 
                                         "Actor/Actress Name  : " + ", ".join(artistsStartingNames))
Пример #2
0
        def loadMoreMovies(self):
                """function to load more movies"""
                
                self.loadActors(self.moviesToLoadEachTime)

                self.loadActresses(self.moviesToLoadEachTime)
                

                if self.moviesDrawnCount < len(self.moviesList):
                        
                        for i in range(self.moviesDrawnCount, len(self.moviesList)):
                                
                                titleOfMovie=((Movie.getMovieTitle(self.moviesList[i])))
                                #adds the title of the movie to the movieNames array.
                                self.movieNames.append(titleOfMovie)
                                
                                
                                # generate random x-axis and y-axis for the ellipses
                                
                                x = random.randint(10, 800)

                                y = random.randint(10, 420)

                                # draw ellipses on the circle
                                oval = self.canvas.create_oval(x, y, x + 20, y + 20, outline="gold", fill="black", width=1)
                                
                                # keep a reference of the oval 


                                self.moviesList[i].setOvalId(oval)
                                self.canvas.tag_bind(oval, '<Button-1>', self.onObjectClick)
                        self.cls()
                        
                        self.Sort(self.movieNames)  
        
                        self.moviesDrawnCount += len(self.moviesList) - self.moviesDrawnCount