Re: [racket-users] Re: GUI executable creating an annoying command line window
Hi Andre This was 100% caused by using an outdated version of DrRacket. In my case the terminal window was just empty, no messages. It seems that If any of your code produces an output in the REPL window of DrRacket that will cause the terminal window to show. Regards Philip On Monday, 1 June 2020 02:00:57 UTC+2, Andre Garzia wrote: > > I noticed a similar behavior if I left any dangling "display" or "write" > in the code, a terminal window would open with those messages in it. Is > this what might be happening to you? > > On Tue, 26 May 2020 at 12:09, Philip Benade > wrote: > >> Hi Alex >> >> I managed to get it working. Updating Dr.Racket to 7.7 did the trick. I >> should have thought of it sooner, but I became so wrapped up in looking for >> the problem in my code I didn't think of it. >> >> Thank you for your help. >> >> Regards >> Philip >> >> On Tuesday, 26 May 2020 11:50:58 UTC+2, Alex Harsanyi wrote: >>> >>> >>> I cannot reproduce this. If I create the executable from the command >>> line using "raco exe --gui work-timer.rkt", or from DrRacket specifying >>> GRacket as the "base", the console window does not show up. >>> >>> If I create the executable using "raco exe work-timer.rkt" or by >>> specifying "Racket" as the base in DrRacket, the console window shows up, >>> but this is expected. >>> >>> I am using Racket 7.7 (BC, not the Chez version). >>> >>> Alex. >>> >>> On Tuesday, May 26, 2020 at 5:00:01 PM UTC+8, Philip Benade wrote: >>>> >>>> Hi All >>>> >>>> I have been trying to create a simple GUI with the racket/gui library. >>>> For the most part it works but alongside my GUI it also creates a command >>>> line window. You can see a screenshot of this in the attached picture. I >>>> found this discussion when I searched for a solution: >>>> https://groups.google.com/forum/#!topic/racket-users/QmvqWtm1x28 In >>>> that case it was happening because there were things that did not return >>>> void. In my case however it is not printing anything, there isn't even any >>>> white space. >>>> >>>> I am using the "Create Executable" option from the "Racket" heading in >>>> Dr.Racket's menu. I set the Type to be "Distribution (to install on other >>>> machines)" and the Base to "GRacket" and keep the "Embed DLLs in the >>>> executable" check box checked. Is there some setting or something I can >>>> change to make this window to go away? >>>> >>>> I have attached my program's .rtk file in case anyone needs it to see >>>> what I'm doing wrong. >>>> >>>> Regards >>>> Philip >>>> >>> -- >> You received this message because you are subscribed to the Google Groups >> "Racket Users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to racket...@googlegroups.com . >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/racket-users/40774e6e-7b89-4cd2-a21a-f1a936783c94%40googlegroups.com >> >> <https://groups.google.com/d/msgid/racket-users/40774e6e-7b89-4cd2-a21a-f1a936783c94%40googlegroups.com?utm_medium=email_source=footer> >> . >> > > > -- > http://www.andregarzia.com > > -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/0be98c95-66dd-4946-b069-a2ba59eb428e%40googlegroups.com.
[racket-users] Re: GUI executable creating an annoying command line window
Hi Alex I managed to get it working. Updating Dr.Racket to 7.7 did the trick. I should have thought of it sooner, but I became so wrapped up in looking for the problem in my code I didn't think of it. Thank you for your help. Regards Philip On Tuesday, 26 May 2020 11:50:58 UTC+2, Alex Harsanyi wrote: > > > I cannot reproduce this. If I create the executable from the command line > using "raco exe --gui work-timer.rkt", or from DrRacket specifying GRacket > as the "base", the console window does not show up. > > If I create the executable using "raco exe work-timer.rkt" or by > specifying "Racket" as the base in DrRacket, the console window shows up, > but this is expected. > > I am using Racket 7.7 (BC, not the Chez version). > > Alex. > > On Tuesday, May 26, 2020 at 5:00:01 PM UTC+8, Philip Benade wrote: >> >> Hi All >> >> I have been trying to create a simple GUI with the racket/gui library. >> For the most part it works but alongside my GUI it also creates a command >> line window. You can see a screenshot of this in the attached picture. I >> found this discussion when I searched for a solution: >> https://groups.google.com/forum/#!topic/racket-users/QmvqWtm1x28 In that >> case it was happening because there were things that did not return void. >> In my case however it is not printing anything, there isn't even any white >> space. >> >> I am using the "Create Executable" option from the "Racket" heading in >> Dr.Racket's menu. I set the Type to be "Distribution (to install on other >> machines)" and the Base to "GRacket" and keep the "Embed DLLs in the >> executable" check box checked. Is there some setting or something I can >> change to make this window to go away? >> >> I have attached my program's .rtk file in case anyone needs it to see >> what I'm doing wrong. >> >> Regards >> Philip >> > -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/40774e6e-7b89-4cd2-a21a-f1a936783c94%40googlegroups.com.
Re: [racket-users] GUI executable creating an annoying command line window
Hi Laurent Unfortunately no, nothing changes. Regards Philip On Tuesday, 26 May 2020 11:47:28 UTC+2, Laurent wrote: > > Does it change anything if you use #lang racket/gui instead of #lang > racket (require racket/gui)? > > On Tue, May 26, 2020 at 10:00 AM Philip Benade > wrote: > >> Hi All >> >> I have been trying to create a simple GUI with the racket/gui library. >> For the most part it works but alongside my GUI it also creates a command >> line window. You can see a screenshot of this in the attached picture. I >> found this discussion when I searched for a solution: >> https://groups.google.com/forum/#!topic/racket-users/QmvqWtm1x28 In that >> case it was happening because there were things that did not return void. >> In my case however it is not printing anything, there isn't even any white >> space. >> >> I am using the "Create Executable" option from the "Racket" heading in >> Dr.Racket's menu. I set the Type to be "Distribution (to install on other >> machines)" and the Base to "GRacket" and keep the "Embed DLLs in the >> executable" check box checked. Is there some setting or something I can >> change to make this window to go away? >> >> I have attached my program's .rtk file in case anyone needs it to see >> what I'm doing wrong. >> >> Regards >> Philip >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Racket Users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to racket...@googlegroups.com . >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/racket-users/3387d77b-e9a6-4777-a46b-ac897596702e%40googlegroups.com >> >> <https://groups.google.com/d/msgid/racket-users/3387d77b-e9a6-4777-a46b-ac897596702e%40googlegroups.com?utm_medium=email_source=footer> >> . >> > -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/4dd78be7-8f09-44d8-bd63-73debd4b5294%40googlegroups.com.
[racket-users] GUI executable creating an annoying command line window
Hi All I have been trying to create a simple GUI with the racket/gui library. For the most part it works but alongside my GUI it also creates a command line window. You can see a screenshot of this in the attached picture. I found this discussion when I searched for a solution: https://groups.google.com/forum/#!topic/racket-users/QmvqWtm1x28 In that case it was happening because there were things that did not return void. In my case however it is not printing anything, there isn't even any white space. I am using the "Create Executable" option from the "Racket" heading in Dr.Racket's menu. I set the Type to be "Distribution (to install on other machines)" and the Base to "GRacket" and keep the "Embed DLLs in the executable" check box checked. Is there some setting or something I can change to make this window to go away? I have attached my program's .rtk file in case anyone needs it to see what I'm doing wrong. Regards Philip -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/3387d77b-e9a6-4777-a46b-ac897596702e%40googlegroups.com. work-timer.rkt Description: Binary data
[racket-users] Re: Button click callback syntax
Hi gfb Thank you for replying to my question. Your reply has saved me from writing unnecessary boiler plate code for my click events. I see the difference between mentioning a function and evaluating it now. What I ended up going for looks like this: ; Make a button in the frame (new button% [parent work-panel] [label "Work"] ; Callback procedure for a button click: [callback (lambda (button event) (send work-msg set-label "Work timer started") (make-timer 25 (lambda () (timer-callback work-msg "Not working" "25 Minutes have passed, take a break."]) Regards Philip On Tuesday, 12 May 2020 20:37:32 UTC+2, gfb wrote: > > The difference is whether you are evaluating an expression, versus > putting it inside a function to be evaluated when the function is called. > > (require racket/gui) > > ; Call message-box, get an immediate effect ... > (message-box "What do you think?" "hi, would you like a tomato" #f > '(yes-no)) > ; The result ('yes or 'no) is printed in the repl/Interactions. > > ; Create a function/procedure, that takes no arguments, and its body calls > message-box ... > (lambda () (message-box "Greeting" "hi, would you like a tomatillo" #f > '(yes-no))) > ; That which prints as # since it's a function, and we didn't > call it. > > ; To call a function we put parentheses around it ... > ((lambda () (message-box "Greeting" "hi, would you like a pomodoro" #f > '(yes-no))) > ) > ; That evaluated the body. > > ; Name a function ... > (define greeter (lambda () (message-box "Greeting" "hi, would you like a > green tomato" #f '(yes-no > ; That didn't call it, and neither do ... > greeter > greeter > ; Those just mention the function, which prints as #. > ; Call it to evaluate the body .. > (greeter) > > By the way, your examples that don't wait 30 minutes actually do, > and if you wait 30 minutes they will try to call the callback, which > is not a function but the 'ok result from the message-box. > > Try setting the timer to something shorter, and then wait after > you click the immediate message box, then when the timer > goes off there will be an error something like ... > application: not a procedure; > expected a procedure that can be applied to arguments > given: 'ok > arguments...: [none] > > -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/d4276f08-2501-46df-bad0-ab43867b75d2%40googlegroups.com.
Re: [racket-users] Button click callback syntax
Hi David Thank you for replying to my question. I have a much better understanding of what is happening now, especially about passing a function instead the result of a function. Thank you. Regards Philip On Tuesday, 12 May 2020 20:08:58 UTC+2, David Storrs wrote: > > Hi Philip, > > The essence here is when evaluation happens: > > ; All of these are equivalent: > (define foo (lambda () 7) > (define foo (thunk 7)) ; 'thunk' is a term of art meaning "function > of 0 arguments" > (define (foo) 7) > > Try running the following code in the repl: > ; start code > (define (general-callback msg-name msg-text message-box-text) ; > function of 3 arguments > 'result-of-general-callback) > general-callback > (general-callback "name" "text" "msg box text") > ; end code > > You'll see that 'general-callback' returns: > #, which is the actual function > and (general-callback ...) returns 'result-of-general-callback, which > is the result of invoking the function. > > > In your GUI code, you want to be passing the function itself, not the > result of invoking the function. > > Does that make sense? > > > On Tue, May 12, 2020 at 12:34 PM Philip Benade > wrote: > > > > Hi All > > > > I am new to Racket and I have found a situation where I'm not certain > why Racket works the way it does. Unfortunately I am not sure of the > vocabulary so I will describe the situation with some code: > > > > > > ; A button made this way works as I would expect, it waits for 30 > minutes and then shows a message-box and plays a sound. > > (new button% [parent long-break-panel] > > [label "Long Break"] > > ; Callback procedure for a button click: > > [callback (lambda (button event) > > (send long-break-msg set-label "Long break > timer started") > > (general-timer 30 long-break-callback))]) > > > > ; A button made this way immediately shows the message box and plays the > sound. > > (new button% [parent long-break-panel] > > [label "Long Break"] > > ; Callback procedure for a button click: > > [callback (lambda (button event) > > (send long-break-msg set-label "Long break > timer started") > > (general-timer 30 (general-callback > long-break-msg "Not on long break" "30 Minutes have passed, back to > work.")))]) > > > > ; A button made this way also immediately shows the message box and > plays the sound. Why is it different when the function name is surrounded > by parentheses? > > (new button% [parent long-break-panel] > > [label "Long Break"] > > ; Callback procedure for a button click: > > [callback (lambda (button event) > > (send long-break-msg set-label "Long break > timer started") > > (general-timer 30 (long-break-callback)))]) > > > > ; The documentation for buttons say they require a callback. I > interpreted this to mean a function that will execute when the button is > clicked. > > (define general-callback > > (lambda (msg-name msg-text message-box-text) > > (time-expired-sound) > > (send msg-name set-label msg-text) > > (message-box "Timer expired" message-box-text frame))) > > > > ; Why does wrapping the function so that it takes no parameters change > how it gets executed? > > (define long-break-callback > > (lambda () > > (general-callback long-break-msg "Not on long break" "30 Minutes > have passed, back to work."))) > > > > > > Is anyone able to explain why I am getting these different behaviors > from these buttons? > > > > Regards > > Philip > > > > -- > > You received this message because you are subscribed to the Google > Groups "Racket Users" group. > > To unsubscribe from this group and stop receiving emails from it, send > an email to racket...@googlegroups.com . > > To view this discussion on the web visit > https://groups.google.com/d/msgid/racket-users/3a6effce-915e-42c8-aff7-56fc23524e4c%40googlegroups.com. > > > -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/56a40f46-d3da-41c5-b737-2a67f7421bfe%40googlegroups.com.
[racket-users] Button click callback syntax
Hi All I am new to Racket and I have found a situation where I'm not certain why Racket works the way it does. Unfortunately I am not sure of the vocabulary so I will describe the situation with some code: ; A button made this way works as I would expect, it waits for 30 minutes and then shows a message-box and plays a sound. (new button% [parent long-break-panel] [label "Long Break"] ; Callback procedure for a button click: [callback (lambda (button event) (send long-break-msg set-label "Long break timer started") (general-timer 30 long-break-callback))]) ; A button made this way immediately shows the message box and plays the sound. (new button% [parent long-break-panel] [label "Long Break"] ; Callback procedure for a button click: [callback (lambda (button event) (send long-break-msg set-label "Long break timer started") (general-timer 30 (general-callback long-break-msg "Not on long break" "30 Minutes have passed, back to work.")))]) ; A button made this way also immediately shows the message box and plays the sound. Why is it different when the function name is surrounded by parentheses? (new button% [parent long-break-panel] [label "Long Break"] ; Callback procedure for a button click: [callback (lambda (button event) (send long-break-msg set-label "Long break timer started") (general-timer 30 (long-break-callback)))]) ; The documentation for buttons say they require a callback. I interpreted this to mean a function that will execute when the button is clicked. (define general-callback (lambda (msg-name msg-text message-box-text) (time-expired-sound) (send msg-name set-label msg-text) (message-box "Timer expired" message-box-text frame))) ; Why does wrapping the function so that it takes no parameters change how it gets executed? (define long-break-callback (lambda () (general-callback long-break-msg "Not on long break" "30 Minutes have passed, back to work."))) Is anyone able to explain why I am getting these different behaviors from these buttons? Regards Philip -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/3a6effce-915e-42c8-aff7-56fc23524e4c%40googlegroups.com.