Я не был уверен, где это поставить
from tkinter import *
the_window = Tk()
the_window.title('Entertainment Guide')
the_window.resizable(width=False, height=False)
canvas = Canvas(the_window, width = 500, height = 100)
canvas.pack()
class App:
def buttoncounter(self):
self.showthis = str([self.videofirstbutton.get(),
self.videosecondbutton.get(),
self.videothirdbutton.get(),
self.videofourthbutton.get(),
self.videofifthbutton.get(),
self.videosixthbutton.get()])
self.counter = print(self.showthis.count('1'))
def __init__(self, master):
self.frame = Frame(the_window)
self.frame.pack()
#the_window.geometry("500x120")
canvas.configure(background='paleturquoise')
self.videogames = Button(self.frame, text = 'Video Games', fg ='violet', width=15, command=self.create_videogameswindow)
self.videogames.pack( side = LEFT )
def printbutton(self):
self.printbutton = Button(self.frame, text="Print Events ", width=15, command=self.buttoncounter) #str(self.counter)
self.printbutton.pack( side = LEFT )
def create_videogameswindow(self):
self.a = videogameswindow = Toplevel(the_window)
self.b = videogameswindow.title('Video Games')
self.c = videogameswindow.resizable(width=False, height=False)
self.heading = Label(videogameswindow, text="Video Game Selector", bg="violet", font=("Helvetica", 16))
self.heading.pack()
self.videofirstbutton = IntVar()
self.videosecondbutton = IntVar()
self.videothirdbutton = IntVar()
self.videofourthbutton = IntVar()
self.videofifthbutton = IntVar()
self.videosixthbutton = IntVar()
self.V1 = Checkbutton(videogameswindow, text = "Video", variable =self.videofirstbutton, onvalue = 1, offvalue = 0, bg='violet').pack(anchor=W)
self.V2 = Checkbutton(videogameswindow, text = "Video", variable =self.videosecondbutton, onvalue = 1, offvalue = 0, bg='violet').pack(anchor=W)
self.V3 = Checkbutton(videogameswindow, text = "Video", variable =self.videothirdbutton, onvalue = 1, offvalue = 0, bg='violet').pack(anchor=W)
self.V4 = Checkbutton(videogameswindow, text = "Video", variable =self.videofourthbutton, onvalue = 1, offvalue = 0, bg='violet').pack(anchor=W)
self.V5 = Checkbutton(videogameswindow, text = "Video", variable =self.videofifthbutton, onvalue = 1, offvalue = 0, bg='violet').pack(anchor=W)
self.V6 = Checkbutton(videogameswindow, text = "Video", variable =self.videosixthbutton, onvalue = 1, offvalue = 0, bg='violet').pack(anchor=W)
self.d = videogameswindow.configure(background='violet')
self.printbutton()
app = App(the_window)
the_window.mainloop()
Отрегулируйте события печати соответственно.