[racket-users] Re: Application Templates!

2020-08-19 Thread Alex Harsanyi
I am not sure that a template in the style of "dotnet new" is directly 
applicable for Racket --  the .Net framework is, well a framework. which is 
a library that expects the users to structure their own programs in certain 
ways.  The templates fill the need of setting up the boilerplate code for 
different kind of applications as required by the .Net framework.  Racket 
applications don't need large amounts of "setup code", most of the code is 
very specific to the application itself, so not sure what a template would 
contain apart from very basic things.

I think Racket would benefit by a suite of applications which are small but 
not trivial and with a source code which is commented in more detail than a 
regular application.  I attempted to do this with my blog posts, some of 
which describe more-or-less complete applications (most of them games). The 
entire source code is in a single file which can be run directly and is 
available as a GitHub Gist linked from the blog posts.

Here are some examples:

* ishido game (936 lines):  
https://gist.github.com/alex-hhh/2e204b3a9d9d7094f65a0b585d0b7480 
* tetris game (893 
lines): https://gist.github.com/alex-hhh/2233aee39852f4e0aead4af4cafb40d5
* chess board (893 lines): 
https://gist.github.com/alex-hhh/4817c4d0353e40b72108e7e753c3d0da
* password generator GUI (346 lines): 
https://gist.github.com/alex-hhh/6acbbb8ebca47c4cfaa2540499494af6
* password generator, command line (142 lines): 
https://gist.github.com/alex-hhh/27286f4609ea0c989675e5c946ca39de

These are of course not templates, but they could serve as the starting 
points for users who already have some experience with programming and want 
to try out some more complex programs.

Alex.

On Thursday, August 20, 2020 at 5:49:37 AM UTC+8 Stephen De Gabrielle wrote:

> I’ve started a small collection!
>
> https://github.com/racket-templates
>
> These are GitHub templates so you use them by clicking ‘use this template‘ 
> on the repo
>
> I’m looking for more ideas/contributions;
> From the top of my head;
> - ‘worker service’ (dotnet new has this)
> - DrRacket plugin
> - Keybinding package
> - Teachpack
> - raco command
> - scribble (multiple)
> - pollen (multiple)
> - slideshow
> - racket embedded in c app
>
> Can you suggest(or submit) any others?
>
> < the reasons is to give new users another way ins>>
>
> Are language specific templates a good idea?
> - typed racket
> - datalog
> - parenlog
> - rosette
>
>
>   Thoughts suggestions criticisms appreciated!
>
> Stephen
>
> On Wed, 19 Aug 2020 at 00:02, Stephen De Gabrielle  
> wrote:
>
>> I got jealous that dot net has dotnet new with lots of templates so I 
>> made a GitHub template for a cli command 
>> https://github.com/spdegabrielle/cli-command 
>>
>> If you have an idea for a template you should make one!
>>
>> If you have a cool package that can be demonstrated as an application 
>> maybe consider a template as a way to introduce new Racketeers to your 
>> package?
>>
>> Best
>>
>> Stephen
>>
>> -- 
>> 
>>
>>
>> -- 
> 
>

-- 
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/856e1c7a-5afc-42d8-89f0-6b6fb81158d5n%40googlegroups.com.


[racket-users] Re: GUI zoom and normal-control-font

2020-08-19 Thread Alex Harsanyi
At least on Windows, users can select the text size in the Windows System 
Settings,and Racket GUI applications will use that setting.   So I can make 
the text of the GUI controls bigger or smaller by adjusting this setting.  
The Racket GUI have to be restarted though for the settings to take effect 
-- they don't react dynamically to text size changes.

Of course this is a system level setting and all applications on the 
machine will use the chosen text size.

Alex.

On Wednesday, August 19, 2020 at 12:31:42 AM UTC+8 James Platt wrote:

> I'm looking at implementing a zoom contents (not zoom window) feature in a 
> GUI with lots of elements and I'm wondering about the best way to do this. 
> Most, if not all, standard GUI widgets in Racket can be resized by changing 
> the font size of their contents or label. Then redraw the widget and you 
> have the whole thing in a new size. So zoom could be done by creating a 
> function which handles each element individually but I would like a more 
> general solution, if possible. Most widgets use the value 
> normal-control-font for their default but it doesn't look like this can be 
> changed at present. If there were a setter for normal-control-font, it 
> looks like you could have a menu item change it, then recursively get the 
> children of the frame it is attached to and redraw them. Would this 
> actually work? Is there a better way to do it?

-- 
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/33fa4a60-6c4b-4948-9288-6ae45a2d75b6n%40googlegroups.com.


Re: [racket-users] GUI zoom and normal-control-font

2020-08-19 Thread George Neuner

On 8/19/2020 1:37 PM, James Platt wrote:
> 
> On 8/18/2020 12:31 PM, James Platt wrote:

>> I'm looking at implementing a zoom contents (not zoom window) feature in a 
GUI with lots of elements and I'm wondering about the best way to do this.  Most, if 
not all, standard GUI widgets in Racket can be resized by changing the font size of 
their contents or label.   Then redraw the widget and you have the whole thing in a 
new size.  So zoom could be done by creating a function which handles each element 
individually but I would like a more general solution, if possible.  Most widgets use 
the value normal-control-font for their default but it doesn't look like this can be 
changed at present.  If there were a setter for normal-control-font, it looks like 
you could have a menu item change it, then recursively get the children of the frame 
it is attached to and redraw them.  Would this actually work? Is there a better way 
to do it?
> 
> If you can access (or render) the contents as a 'pict', then it be scaled somewhat arbitrarily (though a scaled version is not guaranteed to look good).

> https://docs.racket-lang.org/pict/Pict_Drawing_Adjusters.html
> 
> It is a form of BitBLT operation.  I would search the docs for "blt" or "blit" in addition to "scale" and "size".  Sorry I can't point you more directly to relevant functions:  I've done a lot of GUI programming, but, unfortunately, I know it from C++ using device contexts directly, not from using Racket's graphics.


If I understand correctly, I would do that like in the Stackoverflow post 
below.   Note the need for using the bitmap% version of the button label.   The 
advantage of this approach is that you can change the label dynamically with a 
send.  The drawback is that I would have to create a modified version of every 
widget.  I was just hoping for a solution which would not require so much 
customization of a standard Racket package.

https://stackoverflow.com/questions/48414363/how-to-change-the-color-of-text-in-a-racket-gui-button/48468797#48468797


Sorry, it was not clear to me that you wanted to resize widgets (child 
windows).  Typically when one speaks about a window's "content" they are 
referring to text or imagery drawn onto the window's backing bitmap.


Basically, you need to push a resize message to every child.  I'm not 
sure the best way to do that, but my first thought would be something 
involving panels (or panes).  When a panel gets resized, all its 
children are resized as well.

https://docs.racket-lang.org/gui/windowing-overview.html#%28part._containeroverview%29
https://docs.racket-lang.org/gui/panel_.html
https://docs.racket-lang.org/gui/pane_.html

The trick is that normally a panel would be sized relative to its 
parent.  To effect a "zoom" you would have to override that behavior so 
at least the (Z-stack) bottom panel can be made larger than the 
application window's viewing area.


George

--
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/65bbe973-c309-1f92-620a-76d4708f32c7%40comcast.net.


[racket-users] Re: Application Templates!

2020-08-19 Thread Stephen De Gabrielle
I’ve started a small collection!

https://github.com/racket-templates

These are GitHub templates so you use them by clicking ‘use this template‘
on the repo

I’m looking for more ideas/contributions;
>From the top of my head;
- ‘worker service’ (dotnet new has this)
- DrRacket plugin
- Keybinding package
- Teachpack
- raco command
- scribble (multiple)
- pollen (multiple)
- slideshow
- racket embedded in c app

Can you suggest(or submit) any others?

<>

Are language specific templates a good idea?
- typed racket
- datalog
- parenlog
- rosette


  Thoughts suggestions criticisms appreciated!

Stephen

On Wed, 19 Aug 2020 at 00:02, Stephen De Gabrielle 
wrote:

> I got jealous that dot net has dotnet new with lots of templates so I made
> a GitHub template for a cli command
> https://github.com/spdegabrielle/cli-command
>
> If you have an idea for a template you should make one!
>
> If you have a cool package that can be demonstrated as an application
> maybe consider a template as a way to introduce new Racketeers to your
> package?
>
> Best
>
> Stephen
>
> --
> 
>
>
> --


-- 
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/CAGHj7-%2B-4fbJhjgOha1kH%2ByV%3DO01oGeKcqxALwupssrdGT8esA%40mail.gmail.com.


[racket-users] Debugging a tool

2020-08-19 Thread Daniel Melcer
Is it possible to run the debugger on an IDE tool?

Or if that isn't possible, is there a way to get a repl? #lang debug (
https://docs.racket-lang.org/debug/index.html) works for printing out 
values to the console, but adding a call to (debug-repl) causes the code to 
fail raco setup:


write: cannot marshal value that is embedded in compiled code
  value: #
  context...:
   linklet-bundle->bytes
   for-loop
   flatten-linklet-directory
   write-linklet-directory
   /usr/racket/collects/compiler/private/../../racket/private/more-scheme.
rkt:261:28
   /usr/racket/collects/compiler/private/cm-minimal.rkt:730:6
   /usr/racket/collects/racket/private/more-scheme.rkt:148:2: call-with-
break-parameterization
   /usr/racket/collects/racket/file.rkt:262:5
   /usr/racket/collects/compiler/private/cm-minimal.rkt:608:0: compile-zo*
   /usr/racket/collects/compiler/private/cm-minimal.rkt:407:15
   /usr/racket/collects/compiler/private/cm-minimal.rkt:396:12: build
   /usr/racket/collects/compiler/private/cm-minimal.rkt:372:0: maybe-compile
-zo
   /usr/racket/collects/compiler/private/cm-minimal.rkt:206:0: compile-root
   /usr/racket/collects/compiler/private/cm-minimal.rkt:102:4
   /usr/racket/collects/setup/../racket/private/more-scheme.rkt:261:28
   [repeats 1 more time]




-- 
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/d04e0af9-a02e-46d9-8298-5aee13896a95o%40googlegroups.com.


Re: [racket-users] GUI zoom and normal-control-font

2020-08-19 Thread James Platt
> 
> On 8/18/2020 12:31 PM, James Platt wrote:
>> I'm looking at implementing a zoom contents (not zoom window) feature in a 
>> GUI with lots of elements and I'm wondering about the best way to do this.  
>> Most, if not all, standard GUI widgets in Racket can be resized by changing 
>> the font size of their contents or label.   Then redraw the widget and you 
>> have the whole thing in a new size.  So zoom could be done by creating a 
>> function which handles each element individually but I would like a more 
>> general solution, if possible.  Most widgets use the value 
>> normal-control-font for their default but it doesn't look like this can be 
>> changed at present.  If there were a setter for normal-control-font, it 
>> looks like you could have a menu item change it, then recursively get the 
>> children of the frame it is attached to and redraw them.  Would this 
>> actually work? Is there a better way to do it?
> 
> If you can access (or render) the contents as a 'pict', then it be scaled 
> somewhat arbitrarily (though a scaled version is not guaranteed to look good).
> https://docs.racket-lang.org/pict/Pict_Drawing_Adjusters.html
> 
> It is a form of BitBLT operation.  I would search the docs for "blt" or 
> "blit" in addition to "scale" and "size".  Sorry I can't point you more 
> directly to relevant functions:  I've done a lot of GUI programming, but, 
> unfortunately, I know it from C++ using device contexts directly, not from 
> using Racket's graphics.

If I understand correctly, I would do that like in the Stackoverflow post 
below.   Note the need for using the bitmap% version of the button label.   The 
advantage of this approach is that you can change the label dynamically with a 
send.  The drawback is that I would have to create a modified version of every 
widget.  I was just hoping for a solution which would not require so much 
customization of a standard Racket package.  

https://stackoverflow.com/questions/48414363/how-to-change-the-color-of-text-in-a-racket-gui-button/48468797#48468797


-- 
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/08CD0FAF-AFCD-4B43-87C4-422C79AA2361%40biomantica.com.


Re: [racket-users] Unfortunate error message for wrong number of arguments to a format string in printf

2020-08-19 Thread Matthew Flatt
Thanks for the report! This has been fixed for the next release.

Matthew

At Wed, 19 Aug 2020 12:16:24 -0400, William Byrd wrote:
> To wit:
> 
> Chez Scheme Version 9.5.3
> Copyright 1984-2019 Cisco Systems, Inc.
> 
> > (printf "~s")
> 
> 
> Exception in printf: too few arguments for control string "~s"
> Type (debug) to enter the debugger.
> >
> 
> Process scheme finished
> 
> 
> Welcome to Racket v7.8 [cs].
> > (printf "~s")
> 
> ; /: division by zero [,bt for context]
> >
> 
> Cheers,
> 
> --Will
> 
> -- 
> 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/CACJoNKGKzuTt0DdLjOLDv6jbjwxTmga
> UzAmrvL6cfwdz%3Dfsypg%40mail.gmail.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/20200819102010.3a6%40sirmail.smtps.cs.utah.edu.


[racket-users] Unfortunate error message for wrong number of arguments to a format string in printf

2020-08-19 Thread William Byrd
To wit:

Chez Scheme Version 9.5.3
Copyright 1984-2019 Cisco Systems, Inc.

> (printf "~s")


Exception in printf: too few arguments for control string "~s"
Type (debug) to enter the debugger.
>

Process scheme finished


Welcome to Racket v7.8 [cs].
> (printf "~s")

; /: division by zero [,bt for context]
>

Cheers,

--Will

-- 
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/CACJoNKGKzuTt0DdLjOLDv6jbjwxTmgaUzAmrvL6cfwdz%3Dfsypg%40mail.gmail.com.