当前位置: 首页>>代码示例>>Python>>正文


Python Fetcher.search_movie方法代码示例

本文整理汇总了Python中fetcher.Fetcher.search_movie方法的典型用法代码示例。如果您正苦于以下问题:Python Fetcher.search_movie方法的具体用法?Python Fetcher.search_movie怎么用?Python Fetcher.search_movie使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在fetcher.Fetcher的用法示例。


在下文中一共展示了Fetcher.search_movie方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Application

# 需要导入模块: from fetcher import Fetcher [as 别名]
# 或者: from fetcher.Fetcher import search_movie [as 别名]
class Application(Frame):
    def __init__(self, master=None):
        Frame.__init__(self, master)

        self.fetch = Fetcher()

        self.grid(sticky=N+S+E+W)
        self.init_frame()
        self.createSearchEntry()
        self.createInfCanvas()
        self.createInfList()
        self.createDetailCanvas()
        self.createImageLabel()
        self.createDetailLabels()

    def init_frame(self):
        #read the settings file
        self.option_readfile(STYLE_FILE)
        top=self.winfo_toplevel()
        #configure the 
        top.rowconfigure(0, weight=1)
        top.columnconfigure(0, weight=1)
        self.rowconfigure(0, weight=1)
        self.columnconfigure(0, weight=1)
        #apply style
        self.style = Style()
        self.style.theme_use("default")
    
    def createSearchEntry(self):
        self.entry = Entry( self , bg="white")
        self.entry.focus_set()
        self.entry.bind("<KeyRelease>", self.updateSearch)
        self.entry.grid(row=0, columnspan=3, sticky=N+E+W)

    def createInfCanvas(self):
        self.infcanvas = Canvas(self, bg="yellow")
        self.infcanvas.grid(row=1, columnspan=3, sticky=N+W+S+E)
        #let the column1 and column2 to expand equally
        self.infcanvas.columnconfigure(1, weight=1)
        self.infcanvas.columnconfigure(2, weight=1)
        #let the row1 to expand 
        #self.infcanvas.rowconfigure(1, weight=1)

    def createInfList(self):
        self.listbox = Listbox( self.infcanvas , selectmode=SINGLE, bg="white")
        self.listbox.grid(row=1, column=2, sticky=N+E+S+W)
        [ self.listbox.insert(END, item) for item in self.getOriginalList() ]
        self.listbox.bind("<Down>", self.OnEntryDown)
        self.listbox.bind("<Up>", self.OnEntryUp)
        self.listbox.bind("<Button-1>", self.OnClicked)
        self.listbox.select_set(0)
        

    def createImageLabel(self):
        poster_name = "__store/poster/sample.jpg"
        image = Image.open( "%s" % ( poster_name ) )
        #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)

    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:
#.........这里部分代码省略.........
开发者ID:dan-boa,项目名称:MyMovieMonitor,代码行数:103,代码来源:gui.py


注:本文中的fetcher.Fetcher.search_movie方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。