當前位置: 首頁>>代碼示例>>Python>>正文


Python Fetcher.all_movies方法代碼示例

本文整理匯總了Python中fetcher.Fetcher.all_movies方法的典型用法代碼示例。如果您正苦於以下問題:Python Fetcher.all_movies方法的具體用法?Python Fetcher.all_movies怎麽用?Python Fetcher.all_movies使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在fetcher.Fetcher的用法示例。


在下文中一共展示了Fetcher.all_movies方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: Application

# 需要導入模塊: from fetcher import Fetcher [as 別名]
# 或者: from fetcher.Fetcher import all_movies [as 別名]

#.........這裏部分代碼省略.........
        photo = ImageTk.PhotoImage(image)
        self.imagelabel = Label( self.infcanvas, image=photo , anchor=CENTER, bg="white", width=POSTER_W, height=POSTER_H )
        self.imagelabel.image = photo
        self.imagelabel.grid(row=1, column=0, sticky=N+S+E+W)

    def createDetailCanvas(self):
        self.detailCanvas = Canvas( self.infcanvas, bg="white")
        self.detailCanvas.grid(row=1, column=1, sticky=N+S+E+W)
   
    def createDetailLabels(self):
        MAX_MOVIE_WIDTH = 60
        self.movielabel = Label( self.detailCanvas, bg="white", text='Movie name', width=MAX_MOVIE_WIDTH, justify=LEFT, anchor=W, padx=5, pady=10 )
        self.movielabel.grid(row=0, column=0, columnspan=2, sticky=N+S+E+W)

        self.yearlabel = Label( self.detailCanvas, bg="white", text='Year', justify=LEFT, anchor=W, padx=5, pady=10 )
        self.yearlabel.grid(row=1, column=0,  sticky=N+S+E+W)

        self.ratinglabel = Label( self.detailCanvas, bg="white", text='Rating', justify=LEFT, anchor=W, padx=5, pady=10 )
        self.ratinglabel.grid(row=1, column=1, sticky=N+S+E+W)

        self.poplabel = Label( self.detailCanvas, bg="white", text='Popularity', justify=LEFT, anchor=W, padx=5, pady=10 )
        self.poplabel.grid(row=2, column=0, sticky=N+S+E+W)

        self.countrylabel = Label( self.detailCanvas, bg="white", text='Country', justify=RIGHT, anchor=W, padx=5, pady=10 )
        self.countrylabel.grid(row=2, column=1, sticky=N+S+E+W)

        self.overviewlabel = Label( self.detailCanvas, bg="white", text='Overview', justify=LEFT, anchor=W, padx=5, wraplength=500, pady=10 )
        self.overviewlabel.grid(row=3, columnspan=2, sticky=N+S+E+W)

        self.directorlabel = Label( self.detailCanvas, bg="white", text='Director', justify=LEFT, anchor=W, padx=5, pady=10 )
        self.directorlabel.grid(row=4, column=1, sticky=N+S+E+W)

        self.castlabel = Label( self.detailCanvas, bg="white", text='Cast', justify=LEFT, anchor=W, padx=5, pady=10 )
        self.castlabel.grid(row=4, column=0, sticky=N+S+E+W)

        name = self.listbox.get(0)
        self.fetch_inf(name)

    def updateSearch(self, event):
        parameter = self.entry.get()
        result = self.fetch.search_movie(parameter)
        if not result:
            result = ['No result found']
        self.listbox.delete(0, END)
        [ self.listbox.insert(END, item) for item in result ]

    def OnEntryDown(self, event):
        self.listbox.yview_scroll(1,"units")
        curr = int( self.listbox.curselection()[0] )
        if self.listbox.size()-1 == curr:
            curr-=1
        self.listbox.select_clear(curr)
        self.listbox.select_set(curr+1)
        name = self.listbox.get(curr+1)
        self.fetch_inf(name)

    def OnClicked(self, event):
        curr = int( self.listbox.curselection()[0] )
        name = self.listbox.get(curr)
        self.fetch_inf(name)

    def OnEntryUp(self, event):
        self.listbox.yview_scroll(-1,"units")
        curr = int( self.listbox.curselection()[0] )
        if curr == 0:
            curr=1
        self.listbox.select_clear(curr)
        self.listbox.select_set(curr-1)
        name = self.listbox.get(curr-1)
        self.fetch_inf(name)

    def getOriginalList(self):
        return self.fetch.all_movies()

    def fetch_inf(self, name):
        data = self.fetch.movie_inf(name)
        self.movielabel.config(text=name)
        self.yearlabel.config(text=data.get('year',''))
        self.ratinglabel.config(text=data.get('rating',''))
        self.overviewlabel.config(text=data.get('overview',''))
        self.poplabel.config(text=data.get('popularity', ''))
        self.countrylabel.config(text=data.get( 'country', '' ))
        self.directorlabel.config(text=data.get('Director',[' '])[0])
        if len( data.get('Actor',['']) ) > 5:
            data['Actor'] = data['Actor'][:5]
        self.castlabel.config(text='\n'.join( data.get('Actor',[''] )))
        if data.has_key('Poster'):
            self.create_poster(data['Poster'])
        else:
            pass

    def create_poster(self, poster_url):
        #poster_url = '__store/poster/934.jpg'
        image = Image.open( poster_url )
        #crop the poster
        image = image.resize((POSTER_W, POSTER_H), Image.ANTIALIAS)
        photo = ImageTk.PhotoImage(image)
        self.imagelabel = Label( self.infcanvas, image=photo , anchor=CENTER, bg="white", width=POSTER_W, height=POSTER_H )
        self.imagelabel.image = photo
        self.imagelabel.grid(row=1, column=0, sticky=N+S+E+W)
開發者ID:dan-boa,項目名稱:MyMovieMonitor,代碼行數:104,代碼來源:gui.py


注:本文中的fetcher.Fetcher.all_movies方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。