can do is find out where the mouse was clicked after the click has already completed neverthelesswe can make usefulif less prettybutton class our buttons will be rectangular regions in graphics window where user clicks can influence the behavior of the running application we will need to create buttons and determine when they have been clicked in additionit is also nice to be able to activate and deactivate individual buttons that wayour applications can signal which options are available to the user at any given moment typicallyan inactive button is grayed-out to show that it is not available summarizing this descriptionour buttons will support the following methodsconstructor create button in window we will have to specify the window in which the button will be displayedthe location/size of the buttonand the label that will be on the button activate set the state of the button to active deactivate set the state of the button to inactive clicked indicate if the button was clicked if the button is activethis method will determine if the point clicked is inside the button region the point will have to be sent as parameter to the method getlabel returns the label string of the button this is provided so that we can identify particular button in order to support these operationsour buttons will need number of instance variables for examplethe button itself will be drawn as rectangle with some text centered in it invoking the activate and deactivate methods will change the appearance of the button saving the rectangle and text objects as instance variables will allow us to change the width of the outline and the color of the label we might start by implementing the various methods to see what other instance variables might be needed once we have identified the relevant variableswe can write constructor that initializes these values let' start with the activate method we can signal that the button is active by making the outline thicker and making the label text black here is the code (remember the self parameter refers to the button object)def activate(self)"sets this button to 'activeself label setfill('black'self rect setwidth( self active true as mentioned abovein order for this code to workour constructor will have to initialize self label as an appropriate text object and self rect as rectangle object in additionthe self active instance variable stores boolean value to remember whether or not the button is currently active our deactivate method will do the inverse of activate it looks like this