class addtransaction:
    def __init__(self):
        self.window = Tk()
        self.mainframe = Frame(self.window)

        self.instructionL = Label(
            self.mainframe,
            text="Please fill in the fields\nwith appropriate values. ")
        self.cashierL = Label(self.mainframe, text="Cashier: ")
        self.foodorderedL = Label(self.mainframe, text="Food Ordered: ")
        self.earningL = Label(self.mainframe, text="Earning: ")

        self.cashierI = Entry(self.mainframe)
        self.foodorderedI = Entry(self.mainframe)
        self.earningI = Entry(self.mainframe)

        self.okayB = Button(self.mainframe, text="OKAY")
        self.cancelB = Button(self.mainframe,
                              text="CANCEL",
                              command=self.cancel)
        self.mainframe.grid(row=0,
                            column=0,
                            columnspan=2,
                            sticky=W + E + N + S)
        self.mainframe.propagate(0)

        self.instructionL.grid(row=0, column=0, columnspan=2)
        self.cashierL.grid(row=1, column=0)
        self.foodorderedL.grid(row=2, column=0)
        self.earningL.grid(row=3, column=0)

        self.cashierI.grid(row=1, column=1)
        self.foodorderedI.grid(row=2, column=1)
        self.earningI.grid(row=3, column=1)

        self.okayB.grid(row=8, column=0)
        self.okayB.bind("<Button-1>", self.okayE)
        self.cancelB.grid(row=8, column=1)

    def cancel(self):
        self.window.destroy()

    def okayE(self, event):
        info = []
        date = str(datetime.datetime.now())
        cashier = self.cashierI.get()
        foodordered = self.foodorderedI.get()
        earning = self.earningI.get()
        try:
            info.append(date)
            info.append(cashier)
            info.append(foodordered)
            info.append(earning)
            trans = tuple(info)
            QF.addTransaction(trans)
            self.window.destroy()
        except:
            messagebox.showerror("Error",
                                 "Something is Wrong\nCheck your input!")
            self.window.destroy()
    def displayRadios(self, radios: List[RadioStation]):
        if radios is None or len(radios) <= 0:
            label = Label(self.scrollable_frame, text=NO_RADIOS_TEXT)
            label.grid(row=0, column=0, columnspan=4)
            return

        self.icons.clear()
        for i in range(len(radios)):
            radio = radios[i]
            column = i % ROWS
            row = int(i / ROWS)

            frame = Frame(self.scrollable_frame, height=ENTRY_HEIGHT)
            frame.grid(row=row, column=column, sticky='NSWE', padx=10, pady=10)
            frame.propagate(False)

            image = Image.open(radio.pathToImage)
            image = image.resize((ICONS_SIZE, ICONS_SIZE), Image.ANTIALIAS)
            self.icons.append(PhotoImage(image=image))
            iconLabel = Label(frame, image=self.icons[-1])
            iconLabel.pack()

            nameLabel = Label(frame, text=radio.name, font=('Arial', 20))
            nameLabel.pack()

            self.__bindWithChildren(
                frame,
                lambda e, r=radio: self.radioController.onRadioSelected(r))
Beispiel #3
0
class insertgood:
    def __init__(self):
        self.window = Tk()
        self.mainframe = Frame(self.window)

        self.instructionL = Label(
            self.mainframe,
            text="Please fill in the fields\nwith appropriate values. ")
        self.priceL = Label(self.mainframe, text="Price: ")
        self.quantityL = Label(self.mainframe, text="Quantity: ")
        self.typeL = Label(self.mainframe, text="Type: ")

        self.priceI = Entry(self.mainframe)
        self.quantityI = Entry(self.mainframe)
        self.typeI = Entry(self.mainframe)

        self.okayB = Button(self.mainframe, text="OKAY")
        self.cancelB = Button(self.mainframe,
                              text="CANCEL",
                              command=self.cancel)
        self.mainframe.grid(row=0,
                            column=0,
                            columnspan=2,
                            sticky=W + E + N + S)
        self.mainframe.propagate(0)

        self.instructionL.grid(row=0, column=0, columnspan=2)
        self.typeL.grid(row=1, column=0)
        self.priceL.grid(row=2, column=0)
        self.quantityL.grid(row=3, column=0)

        self.typeI.grid(row=1, column=1)
        self.priceI.grid(row=2, column=1)
        self.quantityI.grid(row=3, column=1)

        self.okayB.grid(row=4, column=0)
        self.okayB.bind("<Button-1>", self.okayE)
        self.cancelB.grid(row=4, column=1)

    def cancel(self):
        self.window.destroy()

    def okayE(self, event):
        info = []
        type = self.typeI.get()
        price = self.priceI.get()
        quantity = self.quantityI.get()
        try:
            info.append(type)
            info.append(price)
            info.append(quantity)
            good = tuple(info)
            QF.insertGood(good)
            self.window.destroy()
        except:
            messagebox.showerror("Error",
                                 "Something is Wrong\nCheck your input!")
            self.window.destroy()
class wageposition:
    def __init__(self):
        self.window = Tk()
        self.mainframe = Frame(self.window)

        self.directionL = Label(
            self.mainframe,
            text="Please enter all the fields below with proper input")
        self.idL = Label(self.mainframe, text='ID: ')
        self.positionL = Label(self.mainframe, text='New Position: ')
        self.wageL = Label(self.mainframe, text='New Base Salary: ')

        self.idI = Entry(self.mainframe)
        self.positionI = Entry(self.mainframe)
        self.wageI = Entry(self.mainframe)

        self.okB = Button(self.mainframe, text="OKAY")
        self.cancelB = Button(self.mainframe,
                              text="CANCEL",
                              command=self.cancel)
        self.mainframe.grid(row=0,
                            column=0,
                            columnspan=2,
                            sticky=W + E + N + S)
        self.mainframe.propagate(0)

        self.directionL.grid(row=0, column=0, columnspan=2)
        self.idL.grid(row=1, column=0)
        self.positionL.grid(row=2, column=0)
        self.wageL.grid(row=3, column=0)

        self.idI.grid(row=1, column=1)
        self.positionI.grid(row=2, column=1)
        self.wageI.grid(row=3, column=1)

        self.okB.grid(row=4, column=0)
        self.okB.bind("<Button-1>", self.okayE)
        self.cancelB.grid(row=4, column=1)

    def okayE(self, event):
        info = []
        id = self.idI.get()
        position = self.positionI.get()
        wage = self.wageI.get()
        try:
            info.append(wage)
            info.append(position)
            info.append(id)
            workerinfo = tuple(info)
            QF.updateWorker(workerinfo)
            self.window.destroy()
        except:
            messagebox.showerror("Error",
                                 "Something is Wrong\nCheck your input!")
            self.window.destroy()

    def cancel(self):
        self.window.destroy()
Beispiel #5
0
class removedrink:
    def __init__(self):
        self.window = Tk()
        self.mainframe = Frame(self.window)

        self.instructionL = Label(
            self.mainframe,
            text="Please fill in the fields\nwith appropriate values. ")
        self.drinkL = Label(self.mainframe, text="Drink: ")

        self.drinkI = Entry(self.mainframe)

        self.okayB = Button(self.mainframe, text="OKAY")
        self.cancelB = Button(self.mainframe,
                              text="CANCEL",
                              command=self.cancel)
        self.mainframe.grid(row=0,
                            column=0,
                            columnspan=2,
                            sticky=W + E + N + S)
        self.mainframe.propagate(0)

        self.instructionL.grid(row=0, column=0, columnspan=2)
        self.drinkL.grid(row=1, column=0)
        self.drinkI.grid(row=1, column=1)

        self.okayB.grid(row=3, column=0)
        self.okayB.bind("<Button-1>", self.okayE)
        self.cancelB.grid(row=3, column=1)

    def cancel(self):
        self.window.destroy()

    def okayE(self, event):
        removable = False
        cursor = QF.cursor
        query = "SELECT Drink FROM Beverages;"
        cursor.execute(query)
        info = []
        drink = self.drinkI.get()
        info.append(drink)
        something = tuple(info)

        mylist = []
        for n in cursor:
            mylist.append(n[0])

        if drink in mylist:
            removable = True

        if removable == True:
            QF.removeDrink(something)
            self.window.destroy()
        else:
            messagebox.showerror("Error", "Not a valid Drink!")
            self.window.destroy()
Beispiel #6
0
class givewarning:
    def __init__(self):
        self.window = Tk()
        self.mainframe = Frame(self.window)
        self.instructionL = Label(self.mainframe, text="Please fill in the fields\nwith appropriate values. ")
        self.workerL = Label(self.mainframe, text = "WORKER's ID: ")
        self.warningL = Label(self.mainframe, text = "WARNING: ")

        self.workerI = Entry(self.mainframe)
        self.warningI = Entry(self.mainframe)
        self.okayB = Button(self.mainframe, text = "OKAY")
        self.cancelB = Button(self.mainframe, text = "CANCEL", command = self.cancel)

        self.mainframe.grid(row = 0, column = 0, columnspan = 2, sticky = W + E + N +S)
        self.mainframe.propagate(0)

        self.instructionL.grid(row = 0, column = 0, columnspan = 2)
        self.workerL.grid(row = 1, column = 0)
        self.warningL.grid(row = 2, column = 0)
        self.workerI.grid(row = 1, column = 1)
        self.warningI.grid(row = 2, column = 1)
        self.okayB.grid(row = 3, column = 0)
        self.okayB.bind("<Button-1>", self.okayE)
        self.cancelB.grid(row = 3, column = 1)

    def cancel(self):
        self.window.destroy()

    def okayE(self, event):
        remove = False
        cursor = QF.cursor
        info = []
        warning = self.warningI.get()
        id = self.workerI.get()
        allworker = QF.showEmployee(cursor)
        try:
            if (int(warning) < 0):
                messagebox.showerror("Error", "warning cannot be less than zero.")
                self.window.destroy()

            for n in allworker:
                if (int(id) == int(n[0])):
                    remove = True
            info.append(warning)
            info.append(id)
            warning = tuple(info)
            if remove:
                QF.giveWarning(warning)
                self.window.destroy()
            else:
                messagebox.showerror("Error", "not a valid employee's id.")
                self.window.destroy()
        except:
            messagebox.showerror("Error", "Something is wrong\n Check your input.")
            self.window.destroy()
Beispiel #7
0
class removeworker:
    def __init__(self):
        self.window = Tk()
        self.mainframe = Frame(self.window)

        self.instructionL = Label(
            self.mainframe,
            text="Please fill in the worker's id to be removed.")
        self.workerL = Label(self.mainframe, text="Worker's ID: ")

        self.workerI = Entry(self.mainframe)

        self.okayB = Button(self.mainframe, text="OKAY")
        self.cancelB = Button(self.mainframe,
                              text="CANCEL",
                              command=self.cancel)
        self.mainframe.grid(row=0,
                            column=0,
                            columnspan=2,
                            sticky=W + E + N + S)
        self.mainframe.propagate(0)

        self.instructionL.grid(row=0, column=0, columnspan=2)
        self.workerL.grid(row=1, column=0)
        self.workerI.grid(row=1, column=1)
        self.okayB.grid(row=3, column=0)
        self.okayB.bind("<Button-1>", self.okayE)
        self.cancelB.grid(row=3, column=1)

    def cancel(self):
        self.window.destroy()

    def okayE(self, event):
        removable = False
        cursor = QF.cursor
        query = "SELECT ID FROM Employees"
        cursor.execute(query)
        info = []
        id = self.workerI.get()
        info.append(id)
        idd = tuple(info)
        mylist = []
        for n in cursor:
            mylist.append(str(n[0]))
        if id in mylist:
            removable = True
        if removable == True:
            QF.removeWorker(idd)
            self.window.destroy()
        else:
            messagebox.showerror("Error", "Not a valid Employee!")
            self.window.destroy()
Beispiel #8
0
class removegood:

    def __init__(self):
        self.window = Tk()
        self.mainframe = Frame(self.window)

        self.instructionL = Label(self.mainframe, text="Please fill in the fields\nwith appropriate values. ")
        self.typeL = Label(self.mainframe, text="Type: ")

        self.typeI = Entry(self.mainframe)

        self.okayB = Button(self.mainframe, text="OKAY")
        self.cancelB = Button(self.mainframe, text="CANCEL", command=self.cancel)
        self.mainframe.grid(row = 0, column = 0, columnspan = 2, sticky = W + E + N +S)
        self.mainframe.propagate(0)

        self.instructionL.grid(row = 0, column = 0, columnspan = 2)
        self.typeL.grid(row = 2, column = 0)
        self.typeI.grid(row = 2, column = 1)


        self.okayB.grid(row = 5, column = 0)
        self.okayB.bind("<Button-1>", self.okayE)
        self.cancelB.grid(row = 5, column = 1)

    def okayE(self, event):
        removable = False
        cursor = QF.cursor
        query = "SELECT Type FROM Goods;"
        cursor.execute(query)
        info = []
        foodname = self.typeI.get()
        info.append(foodname)
        good = tuple(info)

        mylist=[]
        for n in cursor:
            mylist.append(n[0])

        if foodname in mylist:
            removable=True

        if removable==True:
            QF.removeGood(good)
            self.window.destroy()
        else:
            messagebox.showerror("Error", "Not a valid Good!")
            self.window.destroy()


    def cancel(self):
        self.window.destroy()
Beispiel #9
0
class addlunch:
    def __init__(self):
        self.window = Tk()
        self.mainframe = Frame(self.window)

        self.instructionL = Label(
            self.mainframe,
            text="Please fill in the fields\nwith appropriate values. ")
        self.lunchL = Label(self.mainframe, text="Lunch Special: ")
        self.priceL = Label(self.mainframe, text="Price: ")

        self.lunchI = Entry(self.mainframe)
        self.priceI = Entry(self.mainframe)

        self.okayB = Button(self.mainframe, text="OKAY")
        self.cancelB = Button(self.mainframe,
                              text="CANCEL",
                              command=self.cancel)

        self.mainframe.grid(row=0,
                            column=0,
                            columnspan=2,
                            sticky=W + E + N + S)
        self.mainframe.propagate(0)

        self.instructionL.grid(row=0, column=0, columnspan=2)
        self.lunchL.grid(row=1, column=0)
        self.priceL.grid(row=2, column=0)
        self.lunchI.grid(row=1, column=1)
        self.priceI.grid(row=2, column=1)
        self.okayB.grid(row=3, column=0)
        self.okayB.bind("<Button-1>", self.okayE)
        self.cancelB.grid(row=3, column=1)

    def okayE(self, event):
        info = []
        lunch = self.lunchI.get()
        price = self.priceI.get()
        try:
            info.append(lunch)
            info.append(price)
            lunch = tuple(info)
            QF.addLunch(lunch)
            self.window.destroy()
        except:
            messagebox.showerror("Error",
                                 "Something is Wrong\nCheck your input!")
            self.window.destroy()

    def cancel(self):
        self.window.destroy()
Beispiel #10
0
    def create_listview(self):
        """
        设置好列后,执行这个函数显示出控件
        """
        if self.__created:
            print('不能再次创建!')
        else:
            self.__created = True
            self.cols_count = len(self.head_tags) - 1  # 第一列用作索引了

            frame1 = Frame(self.tk, relief=RAISED)
            frame1.place(height=self.height,
                         width=self.width,
                         x=self.x,
                         y=self.y)
            frame1.propagate(0)  # 使组件大小不变,此时width才起作用

            # 定义listview
            self.tree = ttk.Treeview(frame1,
                                     columns=self.head_tags,
                                     show='headings')
            self.tree.column(self.head_tags[0],
                             width=self.head_widths[0],
                             anchor='center')  # stretch=YES怎么用
            for i in range(1, len(self.head_tags)):
                self.tree.column(self.head_tags[i],
                                 width=self.head_widths[i],
                                 anchor='center')
                self.tree.heading(self.head_tags[i], text=self.head_texts[i])

            # 设置垂直滚动条
            vbar = ttk.Scrollbar(frame1,
                                 orient=VERTICAL,
                                 command=self.tree.yview)
            self.tree.configure(yscrollcommand=vbar.set)
            # self.tree.grid(row=0, column=0, sticky=NSEW)
            self.tree.grid(row=0, column=0)
            vbar.grid(row=0, column=1, sticky=NS)

            # 设置水平滚动条
            hbar = ttk.Scrollbar(frame1,
                                 orient=HORIZONTAL,
                                 command=self.tree.xview)
            self.tree.configure(xscrollcommand=hbar.set)
            hbar.grid(row=1, column=0, sticky=EW)

            # 绑定事件
            self.tree.bind('<ButtonRelease-1>', self.on_click)  # 绑定行单击事件
Beispiel #11
0
class removelunch:
    def __init__(self):
        self.window = Tk()
        self.mainframe = Frame(self.window)

        self.instructionL = Label(self.mainframe, text="Please fill in the fields\nwith appropriate values. ")
        self.lunchL = Label(self.mainframe, text="Lunch Special: ")

        self.lunchI = Entry(self.mainframe)

        self.okayB = Button(self.mainframe, text="OKAY")
        self.cancelB = Button(self.mainframe, text="CANCEL", command=self.cancel)
        self.mainframe.grid(row = 0, column = 0, columnspan = 2, sticky = W + E + N +S)
        self.mainframe.propagate(0)

        self.instructionL.grid(row = 0, column = 0, columnspan = 2)
        self.lunchL.grid(row = 1, column = 0)
        self.lunchI.grid(row = 1, column = 1)
        self.okayB.grid(row = 3, column = 0)
        self.okayB.bind("<Button-1>", self.okayE)
        self.cancelB.grid(row = 3, column = 1)

    def cancel(self):
        self.window.destroy()

    def okayE(self, event):
        removable=False
        cursor = QF.cursor
        query = "SELECT Name FROM LunchSpecials;"
        cursor.execute(query)
        info = []
        lunch = self.lunchI.get()
        info.append(lunch)
        luncha = tuple(info)
        mylist=[]
        for n in cursor:
            mylist.append(n[0])

        if lunch in mylist:
            removable=True

        if removable==True:
            QF.removeLunch(luncha)
            self.window.destroy()
        else:
            messagebox.showerror("Error", "Not a valid Lunch Special!")
            self.window.destroy()
Beispiel #12
0
 def create_left_toolbar(self, app_frame):
     """
     This function creates and pack the left toolbar
     :param app_frame: root for this toolbar.. (Frame obj)
     :return:
     """
     left_toolbar = Frame(app_frame)
     self.lb_users = Listbox(left_toolbar)
     self.lb_users.config(height=30)
     self.lb_users.grid(row=0, column=0)
     scroll_bar = Scrollbar(left_toolbar)
     scroll_bar.config(command=self.lb_users.yview)
     scroll_bar.grid(row=0, column=1, sticky='ns')
     left_toolbar.propagate("false")
     left_toolbar.grid(column=0, row=0)
     self.lb_users.config(yscrollcommand=scroll_bar.set)
     self.debug_event("Left toolbar was generated")
class modifygood:
    def __init__(self):
        self.window = Tk()
        self.mainframe = Frame(self.window)

        self.instructionL = Label(
            self.mainframe,
            text="Please fill in the fields\nwith appropriate values. ")
        self.priceL = Label(self.mainframe, text="Price: ")
        self.quantityL = Label(self.mainframe, text="Quantity: ")
        self.typeL = Label(self.mainframe, text="Type: ")

        self.priceI = Entry(self.mainframe)
        self.quantityI = Entry(self.mainframe)
        self.typeI = Entry(self.mainframe)

        self.okayB = Button(self.mainframe, text="OKAY")
        self.cancelB = Button(self.mainframe,
                              text="CANCEL",
                              command=self.cancel)
        self.mainframe.grid(row=0,
                            column=0,
                            columnspan=2,
                            sticky=W + E + N + S)
        self.mainframe.propagate(0)

        self.instructionL.grid(row=0, column=0, columnspan=2)
        self.priceL.grid(row=1, column=0)
        self.quantityL.grid(row=2, column=0)
        self.typeL.grid(row=3, column=0)

        self.priceI.grid(row=1, column=1)
        self.quantityI.grid(row=2, column=1)
        self.typeI.grid(row=3, column=1)

        self.okayB.grid(row=4, column=0)
        self.okayB.bind("<Button-1>", self.okayE)
        self.cancelB.grid(row=4, column=1)

    def cancel(self):
        self.window.destroy()

    def okayE(self, event):
        removable = False
        cursor = QF.cursor
        info = []
        price = self.priceI.get()
        quantity = self.quantityI.get()

        try:
            if float(price) < 0 or int(quantity) < 0:
                messagebox.showerror(
                    "Error", "the price or quantity cannot be less than zero.")
                self.window.destroy()
            type = self.typeI.get()
            info.append(price)
            info.append(quantity)
            info.append(type)
            good = tuple(info)
            allgoods = QF.showGood(cursor)
            for n in allgoods:
                if type == n[0]:
                    removable = True
            if removable:
                QF.modifyGood(good)
                self.window.destroy()
            else:
                messagebox.showerror("Error", "the item does not exist.")
                self.window.destroy()
        except:
            messagebox.showerror("Error",
                                 "Something is wrong\n Check your input.")
            self.window.destroy()
Beispiel #14
0
# firstclick1 = True
# def on_text_enter_click(event):
#     """function that gets called whenever entry1 is clicked"""
#     global firstclick1
#     if firstclick1:  # if this is the first time they clicked it
#         firstclick1 = False
#         text_enter.delete('1.0', "end")  # delete all the text in the entry


def des_f1():
    f1.destroy()


f1 = Frame(root, height=700, width=1000)
f1.propagate(0)
f1.pack(side='top')

# start1 = Label(f1, text='VIRTUAL', font=("Arial", 100), fg="magenta")
# start1.place(x=250, y=100)
#
# start2 = Label(f1, text='KEYBOARD', font=("Arial", 100), fg="magenta")
# start2.place(x=150, y=300)

c = Canvas(f1, width=1000, height=700)
c.pack()
p1 = PhotoImage(file="Images/keyboard.png")
c.create_image(200, 100, image=p1, anchor=NW)

start1 = Label(f1,
               text='VIRTUAL KEYBOARD',
class employeeinfo:
    def __init__(self):
        self.window = Tk()
        self.mainframe = Frame(self.window, height=600, width=400)

        self.DOBI = Entry(self.mainframe)
        self.nameI = Entry(self.mainframe)
        self.positionI = Entry(self.mainframe)
        self.baseSalaryI = Entry(self.mainframe)

        self.labelDOB = Label(self.mainframe, text='DOB: ')
        self.labelname = Label(self.mainframe, text='NAME: ')
        self.labelPosition = Label(self.mainframe, text='POSITION: ')
        self.labelBaseSalary = Label(self.mainframe, text='BASE SALARY: ')

        self.okB = Button(self.mainframe, text="OKAY")
        self.cancelB = Button(self.mainframe,
                              text="CANCEL",
                              command=self.cancel)

        self.mainframe.grid(row=0,
                            column=0,
                            columnspan=2,
                            sticky=W + E + S + N)
        self.mainframe.propagate(0)

        self.labelDOB.grid(row=1, column=0)
        self.labelname.grid(row=2, column=0)
        self.labelPosition.grid(row=3, column=0)
        self.labelBaseSalary.grid(row=4, column=0)

        self.DOBI.grid(row=1, column=1)
        self.nameI.grid(row=2, column=1)
        self.positionI.grid(row=3, column=1)
        self.baseSalaryI.grid(row=4, column=1)

        self.okB.grid(row=5, column=0)
        self.okB.bind("<Button-1>", self.okayE)
        self.cancelB.grid(row=5, column=1)

    def okayE(self, event):
        info = []
        dob = self.DOBI.get()
        name = self.nameI.get()
        position = self.positionI.get()
        baseSalary = self.baseSalaryI.get()
        try:
            info.append(dob)
            info.append(baseSalary)
            info.append(name)
            info.append(position)
            workerinfo = tuple(info)
            QF.addWorker(workerinfo)
            self.window.destroy()
        except:
            messagebox.showerror("Error",
                                 "Something is Wrong\nCheck your input!")
            self.window.destroy()

    def cancel(self):
        self.window.destroy()
class addexpense:
    def __init__(self):
        self.window = Tk()
        self.mainframe = Frame(self.window)

        self.instructionL = Label(self.mainframe, text="Please fill in the fields\nwith appropriate values. ")
        self.dateL = Label(self.mainframe, text="Date: ")
        self.electricityL = Label(self.mainframe, text="Electricity: ")
        self.gasL = Label(self.mainframe, text="Gas: ")
        self.waterL = Label(self.mainframe, text="Water: ")
        self.salaryL = Label(self.mainframe, text="Salary: ")
        self.rentL = Label(self.mainframe, text="Rent: ")
        self.costofgoodL = Label(self.mainframe, text="Cost of Goods: ")

        self.dateI = Entry(self.mainframe)
        self.electricityI = Entry(self.mainframe)
        self.gasI = Entry(self.mainframe)
        self.waterI = Entry(self.mainframe)
        self.salaryI = Entry(self.mainframe)
        self.rentI = Entry(self.mainframe)
        self.costofgoodI = Entry(self.mainframe)

        self.okayB = Button(self.mainframe, text="OKAY")
        self.cancelB = Button(self.mainframe, text="CANCEL", command=self.cancel)
        self.mainframe.grid(row = 0, column = 0, columnspan = 2, sticky = W + E + N +S)
        self.mainframe.propagate(0)

        self.instructionL.grid(row = 0, column = 0, columnspan = 2)
        self.dateL.grid(row = 1, column = 0)
        self.electricityL.grid(row = 2, column = 0)
        self.gasL.grid(row = 3, column = 0)
        self.waterL.grid(row = 4, column = 0)
        self.salaryL.grid(row = 5, column = 0)
        self.rentL.grid(row = 6, column = 0)
        self.costofgoodL.grid(row = 7, column = 0)

        self.dateI.grid(row=1, column=1)
        self.electricityI.grid(row=2, column=1)
        self.gasI.grid(row=3, column=1)
        self.waterI.grid(row=4, column=1)
        self.salaryI.grid(row=5, column=1)
        self.rentI.grid(row=6, column=1)
        self.costofgoodI.grid(row=7, column=1)

        self.okayB.grid(row = 8, column = 0)
        self.okayB.bind("<Button-1>", self.okayE)
        self.cancelB.grid(row = 8, column = 1)

    def cancel(self):
        self.window.destroy()

    # Date, Electricity, Gas, Water, Salary, Rent, CostofGood
    def okayE(self, event):
        info = []
        date = self.dateI.get()
        electricity = self.electricityI.get()
        gas=self.gasI.get()
        water=self.waterI.get()
        salary=self.salaryI.get()
        rent=self.rentI.get()
        costofgood=self.costofgoodI.get()
        try:
            info.append(date)
            info.append(electricity)
            info.append(gas)
            info.append(water)
            info.append(salary)
            info.append(rent)
            info.append(costofgood)
            expense = tuple(info)
            QF.addExpense(expense)
            self.window.destroy()
        except:
            messagebox.showerror("Error", "Something is Wrong\nExpenses must be nonnegative numbers!\nCheck your input!")
            self.window.destroy()
Beispiel #17
0
class addfood:
    def __init__(self):
        self.window = Tk()
        self.mainframe = Frame(self.window)

        self.instructionL = Label(
            self.mainframe,
            text="Please fill in the fields\nwith appropriate values. ")
        self.ingredientsL = Label(self.mainframe, text="Ingredients: ")
        self.foodnameL = Label(self.mainframe, text="FoodName: ")
        self.priceL = Label(self.mainframe, text="Price: ")
        self.popularityL = Label(self.mainframe, text="Popularity: ")

        self.ingredientsI = Entry(self.mainframe)
        self.foodnameI = Entry(self.mainframe)
        self.priceI = Entry(self.mainframe)
        self.popularityI = Entry(self.mainframe)

        self.okayB = Button(self.mainframe, text="OKAY")
        self.cancelB = Button(self.mainframe,
                              text="CANCEL",
                              command=self.cancel)
        self.mainframe.grid(row=0,
                            column=0,
                            columnspan=2,
                            sticky=W + E + N + S)
        self.mainframe.propagate(0)

        self.instructionL.grid(row=0, column=0, columnspan=2)
        self.ingredientsL.grid(row=1, column=0)
        self.foodnameL.grid(row=2, column=0)
        self.priceL.grid(row=3, column=0)
        self.popularityL.grid(row=4, column=0)

        self.ingredientsI.grid(row=1, column=1)
        self.foodnameI.grid(row=2, column=1)
        self.priceI.grid(row=3, column=1)
        self.popularityI.grid(row=4, column=1)

        self.okayB.grid(row=5, column=0)
        self.okayB.bind("<Button-1>", self.okayE)
        self.cancelB.grid(row=5, column=1)

    def cancel(self):
        self.window.destroy()

    def okayE(self, event):
        info = []
        ingredients = self.ingredientsI.get()
        foodname = self.foodnameI.get()
        price = self.priceI.get()
        popularity = self.popularityI.get()
        try:
            info.append(ingredients)
            info.append(foodname)
            info.append(price)
            info.append(popularity)
            food = tuple(info)
            QF.addFood(food)
            self.window.destroy()
        except:
            messagebox.showerror("Error",
                                 "Something is Wrong\nCheck your input!")
            self.window.destroy()
if __name__ == '__main__':

    window = Tk()
    window.title("Play-Smart.expertsystem")
    window.geometry('1024x640')
    window.iconbitmap('./game_128px_1234884_easyicon.net.ico')
    window.resizable(width=False, height=False)

    # 第0行与第一行放置给用户的推荐游戏信息
    message = Label(window,
                    text='[EXPERT SYSTEM]',
                    font=('Microsoft YaHei', 18))
    result_window = Frame(window, width=1024, height=180)
    # 保证窗口大小不变
    result_window.propagate(0)
    message.grid(row=0, columnspan=5)
    result_message = Label(result_window, text='还没有推荐内容')
    result_message.pack()
    result_window.grid(row=1, columnspan=5)

    # 第二行设置按钮,有多条推荐信息时用按钮进行切换
    prev_btn = Button(window,
                      text='上一条',
                      command=lambda: switch_property('prev'))
    next_btn = Button(window,
                      text='下一条',
                      command=lambda: switch_property('next'))
    prev_btn.grid(row=2, column=3, sticky='e', ipadx=20, pady=30)
    next_btn.grid(row=2, column=4, ipadx=20)
Beispiel #19
0
from tkinter import Frame
import tkinter as tk
from tkinter import messagebox
from Requests.AutoOta import Filter, Api

root = tk.Tk()

root.title('Auto Ota')

#左边框
# #定义左边框
leftFrame = Frame(root, width=600, height=400)
leftFrame.propagate(False)
leftFrame.pack(side='left')

deviceList = [('GWSL', 1), ('CDSC', 2), ('GWFL', 3)]
v = tk.IntVar()
for lang, num in deviceList:
    choiceFrame = Frame(leftFrame, width=100, height=50, bg='red')
    choiceFrame.propagate(False)
    choiceFrame.pack(side='left', anchor='e', padx=5, pady=5)
    Radio = tk.Radiobutton(choiceFrame, text=lang, variable=v, value=num)
    Radio.grid_propagate(0)
    Radio.grid(row=1, column=1)

root.mainloop()