import tkinter as tk
import tkinter.ttk as ttk
from tkinter import *
from tkinter import messagebox as mb
class App(tk.Frame):
def __init__(self, parent):
tk.Frame.__init__(self, parent, relief=tk.SUNKEN, bd=10)
self.parent = parent
self.parent.geometry('1520x700')
self.parent.resizable(0, 0)
self.parent['bg'] = '#CDC9C9'
self.parent.wm_attributes('-alpha', 0.90)
self.parent.title("Журнал")
self._headings = {1: 'Номер заявки', 2: 'Дата заявки', 3: 'Гаражный номер', 4: 'Вид ТС', 5: 'Модель ТС',
6: 'Гос. рег. знак', 7: 'ДЭУ', 8: 'Вид обслуживания', 9: 'Категория обслуживания',
10: 'Описание неисправности'}
data = {1: 12345, 2: '09072021', 3: 'AYE-282', 4: 'CAR', 5: 'FORD',
6: 'A777AA77', 7: 'QWE', 8: 'REPAIR', 9: 'BEST OFFER',
10: 'CHECK ENGINE'}
self.mainmenu = Menu(self)
root.config(menu=self.mainmenu)
filemenu = Menu(self.mainmenu, tearoff=0)
filemenu.add_command(label="Открыть...")
filemenu.add_command(label="Новый")
filemenu.add_command(label="Сохранить...")
filemenu.add_command(label="Выход")
helpmenu = Menu(self.mainmenu, tearoff=0)
helpmenu.add_command(label="Помощь")
helpmenu.add_command(label="О программе")
self.mainmenu.add_cascade(label="Файл",
menu=filemenu)
self.mainmenu.add_cascade(label="Справка",
menu=helpmenu)
self.tree = ttk.Treeview(
self, height=20, columns=tuple(self._headings.values()),
selectmode=BROWSE, show='headings')
for k, v in self._headings.items():
self.tree.column(f'#{k}', minwidth=20, width=150, stretch=YES, anchor='c')
self.tree.heading(f'#{k}', text=v)
self.tree.column(f'#{7}', minwidth=20, width=50, stretch=YES, anchor='c')
self.tree.heading(f'#{7}', text=self._headings[7])
self.yscrollbar = ttk.Scrollbar(self, orient='vertical', command=self.tree.yview)
self.tree.configure(yscrollcommand=self.yscrollbar.set)
self.tree.grid(row=0, column=0)
self.yscrollbar.grid(row=0, column=1, sticky='nsew')
self.yscrollbar.configure(command=self.tree.yview)
for i in range(100):
insert_data = (i, *tuple(data.values())[1:])
self.tree.insert('', 'end', text='', values=insert_data)
self.get_button = Button(self, text='GET INGO', font=('arial', 20, 'bold'),
width=10, height=1, bd=1, command=self.get_row_info)
self.get_button.grid(row=1, column=0, sticky='s', padx=10, pady=10)
self.info_label = Label(text="SELECT LINE AND PRESS BUTTON")
self.info_label.pack(side=BOTTOM, padx=10, pady=10)
def get_row_info(self):
row_id = self.tree.focus()
if row_id:
values = self.tree.item(row_id)['values']
self.info_label['text'] = str(values)
else:
mb.showerror("Ошибка", "Выберите строку")
if __name__ == "__main__":
root = tk.Tk()
app = App(root)
app.pack(fill="both", expand=True)
app.mainloop()
values_per_key = {}
for d in all_tickets:
for k, v in d.items():
if not values_per_key.get('assignee_id'):
values_per_key['assignee_id'] = 0
else:
values_per_key['assignee_id'] += 1
print(values_per_key )
ids = (123, 456, 789)
cursor.execute('SELECT id FROM users
WHERE game_is_true = "True"
AND game_is_true2 = "False"
AND id NOT IN (?)', (ids ,))
cursor.commit()