
Just saw this tweet: https://twitter.com/spdegabrielle/status/1169192205371793409 and had tried the map widget last night for unlreated reasons (trying to write my own widget..)

this is so great :wink:

@alexharsanyi Impressive!

It was done by @alexharsanyi - his post is at https://groups.google.com/d/msg/racket-users/pzy1jv1s61o/Od78DTdcBQAJ

My custom widget needs are quite a bit more pedestrian, but maybe I can learn some things from that code :wink:

I assume there’s not very much else in the way of widgets for #racket/gui other than the map widget and the builtin ones? Googling for this kind of things is becoming increasingly hard (no I do not want to buy a tennis racket..)

@markus.pfeiffer There are some at http://pkgs.racket-lang.org\|pkgs.racket-lang.org and some older ones at http://planet.racket-lang.org\|planet.racket-lang.org.

If there is a particular type of widget, you can’t find, it is always a good idea to ask. For common widget types, odds are that someone has needed it before you.

If I remember correctly “gui” is better search term than widget on pkgs.racket-lang.

yesterday I was looking for a colour-picker of some description (doesn’t need to be fancy either at the moment)

I am almost sure there is one in gui.

its alwasy possible i am too daft to look properly of course

Not at all. I can’t find it in the gallery.

After gui I always look in framework: https://docs.racket-lang.org/framework/index.html?q=color%25 (Can’t find the color picker though)

get-color-from-user

It was in gui.


yeah, that’s a modal dialogue though

I am making a control program for Zigbee lights; right now I am just using sliders which works, but is a bit awkward

Oh, you need something that can be part of a window.

maybe it’s “easy” to make (for varying values of easy)

Do macOS/Windows/Linus have standard color pickers? If so the task is somewhat involved.

well, I don’t need the environment-specific one, I could make a CIE-xy picker

I think this sholdn’t be too hard (tm), mostly need to translate coordinates on the widget into the x-y values and draw the correct colours into the widget

yes more work than I’d hoped, but not an impossible task :wink:

and I enjoy coding in racket way too much to dread the prospect of some hacking

Maybe @alexharsanyi know of one?

The code for get-color-from-user has a fallback which is used on platforms with no system color picker. That part of the code could be reused without problems as far as I can see.

Line 306–307 uses the system color picker, and the 308- has the fallback.

oh cool

thanks, @soegaard2

I can use that and even play with changing it a bit.

Thanks. This was really an exercise in moving code around and implementing two interfaces: one for canvas% and one for snip%. The map drawing code is essentially the same. The reason that it worked with so little effort is because of the solid design of the racket gui library.

I have implemented a few widgets of my own for my application, but they are not in separate packages. Not sure what widgets you are after, but you can take inspiration from here: https://github.com/alex-hhh/ActivityLog2/tree/master/rkt/widgets — there is also a readme file explaining what each one does.

You can use the get-color-from-user
function from the Racket GUI library. It uses the platform specific color picker,
