[racket] plot3d & canvas question

From: Doug Williams (m.douglas.williams at gmail.com)
Date: Tue Feb 7 16:30:11 EST 2012

I made a plot-canvas% class that I use. The new plot package made it pretty
easy. But it doesn't support the rotation, etc functionality from the snip.
It does, however, support printing which is nice.

On Monday, February 6, 2012, Neil Toronto <neil.toronto at gmail.com> wrote:
> Yes, because a plot is a snip%. It's easy to do something quick and dirty.
> But doing it right takes more than just a few object creations and method
calls. You also need to disable edit operations, hide the caret, etc.,
without disabling the editor itself. If it's disabled entirely, it won't
receive mouse events.
> So it's... easy, but not entirely straightforward? That's probably the
best description, and also why it might be a good idea for me to add
`plot-canvas' and `plot3d-canvas' functions, or a plot-canvas% class.
> Neil ⊥
> On 02/06/2012 06:48 PM, Robby Findler wrote:
>> Just to be sure I'm understanding: you can put this into any GUI where
>> you can put an editor-canvas% object, right? So it should just be a
>> couple of object creations and method calls to get this going?
>> Robby
>> On Mon, Feb 6, 2012 at 5:41 PM, Neil Toronto<neil.toronto at gmail.com>
>>> On 02/06/2012 04:14 AM, Nikolaus Klepp wrote:
>>>> Hi!
>>>> When I create a 3D plot in DrRacket, I can rotate the plot by clicking
>>>> it
>>>> and dragging the mouse. Now I would like to embed the same plot with
>>>> same
>>>> ability in my GUI. Is there an easy way to do that?
>>> Great idea!
>>> Unfortunately, I didn't think of making an easy way to do it.
>>> `plot' already does something similar: if you set (plot-new-window? #t),
>>> plots appear on a canvas in a new frame. You just need to do that
>>> the frame.
>>> The relevant code is in "<racket-dir>/collects/plot/common/gui.rkt",
>>> specifically the `make-snip-frame' function.
>>> The basic idea is to make a canvas containing a single read-only-text%
>>> is initially writable, insert the snip (which you get from `plot-snip'
>>> `plot3d-snip'), and then set the text to read-only. If you want to
>>> the plot, set the text writable, delete the snip, insert the new one,
>>> set it read-only again.
>>> If you don't mind my asking, what are you plotting in your gui?
>>> Neil ⊥
>>> ____________________
>>>  Racket Users list:
>>>  http://lists.racket-lang.org/users
> ____________________
>  Racket Users list:
>  http://lists.racket-lang.org/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20120207/011ea580/attachment.html>

Posted on the users mailing list.