def update_step_result(): global simulator self.res = results() self.step1.configure(text=self.res.executed_step(self.day_variable.get(), 1 )) self.step2.configure(text=self.res.executed_step(self.day_variable.get(), 0)) self.step3.configure(text=self.res.executed_step(self.day_variable.get(), 0)+self.res.executed_step( self.day_variable.get(), 1)) self.step4.configure(text=self.res.sold(self.day_variable.get())) self.step5.configure(text=self.res.publ_step(self.day_variable.get())) self.step6.configure(text=self.res.popular_book(self.day_variable.get())) self.step7.configure(text=self.res.popular_author(self.day_variable.get())) self.step8.configure(text=self.res.popular_publisher(self.day_variable.get())) self.step9.configure(text=self.res.popular_customer(self.day_variable.get())) self.step10.configure(text=self.res.popular_theme(self.day_variable.get())) self.step11.configure(text=self.res.income(self.day_variable.get(), self.e1.get(), self.e2.get())) self.total1.configure(text=self.res.executed_all(1)) self.total2.configure(text=self.res.executed_all(0)) self.total3.configure(text=self.res.executed_all(1)+self.res.executed_all(0)) self.total4.configure(text=self.res.sold_all()) self.total5.configure(text=self.res.publ_all()) self.total6.configure(text=self.res.popular_book_all()) self.total7.configure(text=self.res.popular_author_all()) self.total8.configure(text=self.res.popular_publisher_all()) self.total9.configure(text=self.res.popular_customer_all()) self.total10.configure(text=self.res.popular_theme_all()) self.total11.configure(text=self.res.total_income(self.e1.get(), self.e2.get())) self.total12.configure(text=self.res.books_by_order()) x,y, middle = self.res.price_by_order() self.total13.configure(text=middle) simulator.set_popularity()
def book_book(x): re = results() res = re.book_by_parameter(x) app4 = Toplevel() Label(app4, text='Параметр', bg='gray', anchor='w').grid(row=0, column=0, sticky=(S, W, E, N)) Label(app4, text='Кількість', bg='gray', anchor='w').grid(row=0, column=1, sticky=(S, W, E, N)) for i in range(len(res)): for j in range(len(res[i])): Label(app4, text=res[i][j], bg='white', anchor='w').grid(row=i + 1, column=j, sticky=(S, W, E, N))
def assort(): re = results() res = re.assortment() app2 = Toplevel() Label(app2, text='Назва книги', bg='gray', anchor='w').grid(row=0, column=0, sticky=(S,W,E,N)) Label(app2, text='Автор', bg='gray', anchor='w').grid(row=0, column=1, sticky=(S,W,E,N)) Label(app2, text='Видавництво', bg='gray', anchor='w').grid(row=0, column=2, sticky=(S,W,E,N)) Label(app2, text='Кількість сторінок', bg='gray', anchor='w').grid(row=0, column=3, sticky=(S,W,E,N)) Label(app2, text='Рік видання', bg='gray', anchor='w').grid(row=0, column=4, sticky=(S,W,E,N)) Label(app2, text='Популярність (%)',bg='gray', anchor='w').grid(row=0, column=6, sticky=(S,W,E,N)) Label(app2, text='Книг в магазині', bg='gray', anchor='w').grid(row=0, column=5, sticky=(S, W, E, N)) for i in range(len(res)): for j in range(len(res[i])): Label(app2, text=res[i][j], bg='white', anchor='w').grid(row=i+1, column=j, sticky=(S,W,E,N))
def publisher_orders(): re = results() res = re.publisher_orders() app3 = Toplevel() Label(app3, text='Номер', bg='gray', anchor='w').grid(row=0, column=0, sticky=(S, W, E, N)) Label(app3, text='Кількість', bg='gray', anchor='w').grid(row=0, column=1, sticky=(S, W, E, N)) Label(app3, text='Видавництво', bg='gray', anchor='w').grid(row=0, column=2, sticky=(S, W, E, N)) Label(app3, text='Назва книги', bg='gray', anchor='w').grid(row=0, column=3, sticky=(S, W, E, N)) Label(app3, text='День', bg='gray', anchor='w').grid(row=0, column=4, sticky=(S, W, E, N)) Label(app3, text='Днів до виконання', bg='gray', anchor='w').grid(row=0, column=5, sticky=(S, W, E, N)) for i in range(len(res)): for j in range(len(res[i])): if res[i][j]==-1 or res[i][j]==-2 or res[i][j]==-3: res[i][j]='Done' Label(app3, text=res[i][j], bg='white', anchor='w').grid(row=i + 1, column=j, sticky=(S, W, E, N))
def orders(): re = results() if self.day_variable.get()==0: res = re.orders(1) else: res = re.orders(self.day_variable.get()) app3 = Toplevel() Label(app3, text='Номер', bg='gray', anchor='w').grid(row=0, column=0, sticky=(S, W, E, N)) Label(app3, text='Назва книги', bg='gray', anchor='w').grid(row=0, column=1, sticky=(S, W, E, N)) Label(app3, text='Автор', bg='gray', anchor='w').grid(row=0, column=2, sticky=(S, W, E, N)) Label(app3, text='Тематика', bg='gray', anchor='w').grid(row=0, column=3, sticky=(S, W, E, N)) Label(app3, text='Кількість', bg='gray', anchor='w').grid(row=0, column=4, sticky=(S, W, E, N)) Label(app3, text='Ім\'я покупця', bg='gray', anchor='w').grid(row=0, column=5, sticky=(S, W, E, N)) Label(app3, text='Телефон', bg='gray', anchor='w').grid(row=0, column=6, sticky=(S, W, E, N)) Label(app3, text='День', bg='gray', anchor='w').grid(row=0, column=7, sticky=(S, W, E, N)) Label(app3, text='Виконання замовлення', bg='gray', anchor='w').grid(row=0, column=8, sticky=(S, W, E, N)) Label(app3, text='Наявність книги', bg='gray', anchor='w').grid(row=0, column=9, sticky=(S, W, E, N)) for i in range(len(res)): for j in range(len(res[i])): if j==8 or j==9: if res[i][j]==1: res[i][j]='Done' if res[i][j]==0: res[i][j]='Waiting' Label(app3, text=res[i][j], bg='white', anchor='w').grid(row=i+1, column=j, sticky=(S,W,E,N))
def plot(): if self.day_variable.get()!=0: self.res = results() x,y,r = self.res.price_by_order() plt.plot(sorted(x),y) plt.show()