コード例 #1
0
ファイル: main.py プロジェクト: goodnessm3/calorie-tracker
    def __init__(self, *args, **kwargs):

        super().__init__(*args, **kwargs)
        self.cont1 = Frame(self)
        self.cont2 = Frame(self)
        self.ingredient_autocompletes = db.get_all_ingredient_names()
        self.recipe_autocompletes = db.get_all_recipe_names()

        for label in ("name", "amount", "unit"):
            la = Label(self.cont2)
            la.configure(text=label)
            la.pack(side=LEFT, fill=BOTH, expand=YES)
        self.cont2.pack(side=TOP, fill=BOTH, expand=YES)

        self.name_entry = Entry(self.cont1)
        self.name_entry.pack(side=LEFT)
        self.name_entry.bind("<KeyRelease>", self.te_function)
        self.name_entry.bind("<Tab>", self.te_tab_down)
        self.name_entry.bind("<Up>", self.te_arrow)
        self.name_entry.bind("<Down>", self.te_arrow)
        # override behaviour where tab selects the next widget
        # returning "break" stops the event from propagating

        self.amount_entry = Entry(self.cont1)
        self.amount_entry.pack(side=LEFT)

        self.unit_entry = Entry(self.cont1)
        self.unit_entry.pack(side=LEFT)

        self.unit_entry.bind("<Return>", self.master.master.add_entry)
        # NOTE: "<Enter>" means when the mouse enters the widget
        self.unit_entry.bind("<Tab>", self.unit_tab_down)

        self.cont1.pack(side=TOP)

        self.checkbox_var = IntVar()
        self.speculative_container = Frame(self)
        self.spec_label = Label(self.speculative_container, text="Speculative")
        self.spec_label.pack(side=LEFT)
        self.spec_checkbox = Checkbutton(self.speculative_container,
                                         variable=self.checkbox_var)
        self.spec_checkbox.pack(side=LEFT)
        self.speculative_container.pack(side=TOP)

        self.content = ""
        self.unit = None
        self.vessel = None

        self.lb = Listbox(self, exportselection=0)
        self.lb.pack(side=TOP, fill=BOTH, expand=YES, pady=10)
        for word in self.ingredient_autocompletes:
            self.lb.insert(0, word)
        self.lb.selection_set(0)

        self.recipe_box = Listbox(self, exportselection=0)
        self.recipe_box.pack(side=TOP, fill=BOTH, expand=YES)
        for word in db.get_all_recipe_names():
            self.recipe_box.insert(0, word)
        self.recipe_box.selection_set(0)
コード例 #2
0
ファイル: app.py プロジェクト: zippleer/cse491-drinkz
 def rpc_get_recipe_names(self):
     return str(db.get_all_recipe_names())
コード例 #3
0
ファイル: app.py プロジェクト: dwigell/cse491-drinkz
 def rpc_get_recipe_names(self):
     names = db.get_all_recipe_names()
     return names
コード例 #4
0
ファイル: main.py プロジェクト: goodnessm3/calorie-tracker
    def refresh_autocompletes(self):

        self.ingredient_autocompletes = db.get_all_ingredient_names()
        self.recipe_autocompletes = db.get_all_recipe_names()