Question: PYTHON: Create a frame with two buttons in it: a counter button and a quit button. The counter button keeps track of the number of
PYTHON:
Create a frame with two buttons in it: a counter button and a quit button. The counter button keeps track of the number of times it has been clicked. The quit button closes the frame. You can use a lambda or separate function your choice.
The buttons can be any design you want even just a default. The buttons and frame must be defined in a class.

This is what I have so far:
import sys
from tkinter import *
def counterButtonWindow(): root = Tk() app = CounterApp(root)
root.mainloop() root.destroy()
class CounterApp(object): def showCount(self): count = 0 for num in ctbutton: num+= count return num def __init__(self,master): frame=Frame(master) frame.pack() ctbutton=Button(frame, text= 'Emergency!',fg= 'red', width=100, borderwidth = 3, command = lamda:print('You have clicked the button {} times.'.format(num))) ctbutton.pack(side=TOP) qbutton=Button(frame, text='QUIT1', borderwidth=20, command = frame.quit) qbutton.pack(side=Bottom)
tk Add 1 QUIT! counter ButtonWindow You have clicked the button 1 times You have clicked the button 2 times You have clicked the button 3 times You have clicked the button 4 times You have clicked the button 5 times You have clicked the button 6 times You have clicked the button 7 times You have clicked the button 8 times You have clicked the button 9 times You have clicked the button 10 times You have clicked the button 11 times
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
