Question: I'm trying to create a program in Racket where the user is given several button options to choose from. Once they click on a button,
I'm trying to create a program in Racket where the user is given several button options to choose from. Once they click on a button, I want the program to give a new message with new buttons for the user to choose from, thus getting rid of the old buttons(for now until the user decides they want to start over again). This is what I have in my code so far:
Frame
(define frame (new frame% [label "Pick Yo Choice"] [width 300] [height 300])) Messsage asking user to pick a choice
(define choice-msg (new message% [label "Pick yo choice"] [parent frame] )) Buttons
(define choice-1 (new button% [parent frame] [label "choice 1"] [min-width 200] [min-height 10] )) (define choice-2 (new button% [parent frame] [label "choice 2"] [min-width 200] [min-height 10] )) Show frame
(send frame show #t)
I think the key to solving this mystery has to do with the callback function which gets invoked whenever the button is clicked on. The problem is I'm totally lost and don't know the code for replacing the contents inside the frame? If someone could show me code on how to do this that would be much appreciated since I'm just learning gui. Please dont post code from a different language besides Racket!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
