Есть программа "Кинотеатр" в которой ключом является номер кинозала, а значением занятые места (вложенный словарь). Каким образом можно удалить занятое занятое место из словаря?
И еще как можно добавить значение занятых мест во вложенный словарь?
import sys
import tkinter as tk
import tkinter.ttk as ttk
from functools import partial
from tkinter import *
def vp_start_gui():
global val, w, root
root = tk.Tk()
top = Toplevel1(root)
root.mainloop()
def create_Toplevel1(root, *args, **kwargs):
rt = root
w = tk.Toplevel(root)
top = Toplevel1(w)
class Toplevel1:
def __init__(self, top=None):
_bgcolor = '#d9d9d9'
_fgcolor = '#000000'
_compcolor = '#d9d9d9'
_ana1color = '#d9d9d9'
_ana2color = '#ececec'
top.geometry("600x450+650+150")
top.title("New Toplevel")
top.configure(background="#d9d9d9")
self.Button1 = tk.Button(top)
self.Button1.place(relx=0.133, rely=0.533, height=54, width=187)
self.Button1.configure(activebackground="#ececec")
self.Button1.bind('<Button-1>', partial(self.button_click_handler, 1))
self.Button1.configure(activebackground="#ececec", activeforeground="#000000", background="#d9d9d9",
disabledforeground="#a3a3a3", foreground="#000000", highlightbackground="#d9d9d9",
highlightcolor="black", pady="0", text='''Кинотеатр №1''', width=197)
self.Button2 = tk.Button(top)
self.Button2.place(relx=0.5, rely=0.533, height=54, width=197)
self.Button2.bind('<Button-1>', partial(self.button_click_handler, 2))
self.Button2.configure(activebackground="#ececec", activeforeground="#000000", background="#d9d9d9",
disabledforeground="#a3a3a3", foreground="#000000", highlightbackground="#d9d9d9",
highlightcolor="black", pady="0", text='''Кинотеатр №2''', width=197)
def button_click_handler(self, SIGNAL, event):
root = Tk()
for i in range(10):
for j in range(10):
but = Button(root,
background="#ccc",
foreground="#555",
padx="20",
pady="8",
# state= 'active',
font="16",
width="1",
)
but.configure()
but["text"] = str(j + 1)
but.bind("<Button-1>", self.changeBut)
# but.bind("<Button-1>", lambda event, but=but: changeBut(event, but))
but.grid(row=i, column=j)
lab = Label(root, text="ряд " + str(i))
lab.grid(row=i, column=(j + 1))
self.sp = {}
self.var = SIGNAL
def changeBut(self, event):
event.widget["background"] = "red"
self.sp[self.var] = event.widget
if __name__ == '__main__':
vp_start_gui()