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


Python Frame.bind_all方法代码示例

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


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

示例1: __init__

# 需要导入模块: from Tkinter import Frame [as 别名]
# 或者: from Tkinter.Frame import bind_all [as 别名]
    def __init__(self, master):

        # sets the image repository and the user labeled data
        self.dictionaryLocation = "PreLabeledTrainingData/women/"
        
        self.autoLabels = "AutoLabeledData/labels.csv"
        self.autoImageLocation = "AutoLabeledData/"
        self.autoFaceLocation = "AutoLabeledData/Faces/"
        
        self.newImageLocation = "UserTrainingData/"
        self.labelLocation = "UserTrainingData/womenlabels.csv"
        #self.newImageLocation = "AutoLabeledData/"
        #self.labelLocation = "AutoLabeledData/labels.csv"
        
        self.userPredictor = userPredictor.UserPredictor("Models/", '/home/testing32/Downloads/word2vec/trunk/vectors.bin', "user_")

        self.images = None
        self.currentImage = None
        self.currentUser = None
        self.matches = []
        self.master = master

        # set the title
        master.wm_title("Automatic Tinder")

        # binds the frame and the key events
        button_frame = Frame(master)
        button_frame.bind_all("<Key>", self.key_press)
        button_frame.pack()

        # default menu value
        variable = StringVar(button_frame)
        variable.set("Local") 
        
        # set up the drop down menu for switching between Local images and Tinder images
        w = OptionMenu(button_frame, variable, "Local", "Tinder", command=self.menu_change)
        w.pack(side=LEFT)
        
        # create the "No" button
        self.no_btn = Button(button_frame, text="NO (1)", fg="red", command=self.no)
        self.no_btn.pack(side=LEFT)

        # create the "Yes" button
        self.yes_btn = Button(button_frame, text="YES (2)", fg="blue", command=self.yes)
        self.yes_btn.pack(side=LEFT)
        
        # create the "Automate" button
        self.auto_btn = Button(button_frame, text="Automate", fg="brown", command=self.auto)
        self.auto_btn.pack(side=LEFT)
        
        # create the "Previous Image" button
        self.prev_img_btn = Button(button_frame, text="Previous Image", fg="black", command=self.showPreviousImage)
        self.prev_img_btn.pack(side=LEFT)
        
        # create the "Next Image" button
        self.next_img_btn = Button(button_frame, text="Next Image", fg="black", command=self.showNextImage)
        self.next_img_btn.pack(side=LEFT)
        
        # create the "Matches" button
        self.matches_text = StringVar(value="Matches (0)")
        self.matches_btn = Button(button_frame, textvariable=self.matches_text, command=self.openMatches)
        self.matches_btn.pack(side=BOTTOM)
        
        # Setting up the profile text area
        profile_frame = Frame(master)
        profile_frame.pack()
        
        self.profile_text = StringVar(value="")
        self.profile_lbl = Label(profile_frame, textvariable=self.profile_text, width=60,wraplength=475)
        self.profile_lbl.pack(side=BOTTOM)
        
        # Setting up the image area
        image_frame = Frame(master)
        image_frame.pack()
        
        # load the image
        self.pic = Label()
        self.pic.pack(side=BOTTOM)
        
        # create the interface to our data
        """
        self.imgInterface = AutoDataWrapper(
            self.dictionaryLocation, 
            self.labelLocation)
        """
        self.imgInterface = LocalDataWrapper(
            self.dictionaryLocation, 
            self.labelLocation)
        
        # Load the next user from the image interface
        self.loadUser(self.imgInterface.getNextUser())
开发者ID:testing32,项目名称:AutomatedTinder,代码行数:93,代码来源:tinderUI.py


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