Hi Squeakers,
In Etoys, can I make some drawing that was the result of a script become an object? For example, consider the simple circle-drawing script (fwd by, turn by, pen down). Can I somehow treat that resulting circle as an object and thereby make copies of it, etc? I realize that I could use either the 'Grab Patch' or 'Lasso' in the Supplies to manually "select" the circle, however that approach of course gives me more pixels than I really want.
Thanks, Randy
Hi, Randy,
There's no direct feature for doing this right now, though it's easy enough to add one -- load in the attached project, for example -- it adds an item "snapshot pen trails" to the various pen-trails-related menus for a playfield; please try it out and see what you think.
By the way, when you do use one of the screen-grabbing tools to create a new "Sketch," from pen-trails or from anything else on the screen, here's a way you can get rid of those "more pixels than you really want"...
From the halo menu of the SketchMorph created by the grab, choose "painting..." and from the resulting submenu...
choose "erase pixels of color". Now you'll be presented with a cursor; click on the color of the superfluous background you want to erase, and voilà! -- just what you wanted. And notice that the resulting Sketch is smartly trimmed down accordingly.
Cheers,
-- Scott
At 2:09 PM -0500 5/25/05, Randy Heiland wrote:
Hi Squeakers,
In Etoys, can I make some drawing that was the result of a script become an object? For example, consider the simple circle-drawing script (fwd by, turn by, pen down). Can I somehow treat that resulting circle as an object and thereby make copies of it, etc? I realize that I could use either the 'Grab Patch' or 'Lasso' in the Supplies to manually "select" the circle, however that approach of course gives me more pixels than I really want.
Thanks, Randy
Hi Randy,
something along the lines of:
:-)
Try the following:
And use a curve or polygon and not a star, if you want to play with the handles later on...
Michael, any chance for inclusion of this one into the main image? I basically posted the same change-set two years ago.
Fixes: - I renamed vertices into points now, as I guess most will understand that better... - The vertice added comes from referencePosition and not from position any more.
Shall I resend this to squeak-dev as an [ENH]?
Cheers,
Markus
Hi Squeakers,
In Etoys, can I make some drawing that was the result of a script become an object? For example, consider the simple circle-drawing script (fwd by, turn by, pen down). Can I somehow treat that resulting circle as an object and thereby make copies of it, etc? I realize that I could use either the 'Grab Patch' or 'Lasso' in the Supplies to manually "select" the circle, however that approach of course gives me more pixels than I really want.
Thanks, Randy
Squeakland mailing list Squeakland@squeakland.org http://squeakland.org/mailman/listinfo/squeakland
Am 25.05.2005 um 21:09 schrieb Randy Heiland:
Hi Squeakers,
In Etoys, can I make some drawing that was the result of a script become an object? For example, consider the simple circle-drawing script (fwd by, turn by, pen down). Can I somehow treat that resulting circle as an object and thereby make copies of it, etc? I realize that I could use either the 'Grab Patch' or 'Lasso' in the Supplies to manually "select" the circle, however that approach of course gives me more pixels than I really want.
Hi Randy,
this is not quite possible out-of-the-box, as far as I know. However, nothing is impossible in Squeak ;-)
Here's what you can do:
1. Make a new playfield. 2. Place your drawing player in the playfield. 3. Let it draw. 4. Set the playfield's graphic to the drawn pen trails. 5. Make a new sketch. 6. assign the playfield's graphic to the sketch's graphic. 7. You're done :-)
Now that seems straight-forward, but unfortunately there is no "setGraphicFromTrails" tile that we need for step 4. We'll need a bit of magic. Here is how to make that tile: 4a. Get a viewer on the playfield. 4b. From the "playfield" category, drag out the arrow tile for "playfields graphic", making a script. 4c. Rename the script to "setGraphicFromTrails". 4d. Switch the script to textual mode (click the square checkbox in the upper left of the script) 4e. Replace the text shown there: ===================== setGraphicFromTrails self setGraphic: Form3 ===================== with the following (just copy and paste): ===================== setGraphicFromTrails self setGraphic: ((self costume instVarNamed: #turtleTrailsForm) ifNotNilDo: [:f | f trimBordersOfColor: Color transparent]) ===================== Accept using Cmd-s (Alt-s on PC). 4f. Hide the script with the "o" button. 4f. In the playfield's scripts category you'll find your shiny new "setGraphicFromTrails" tile.
For step 6, you could make a skript for the sketch like this:
Playfield setGraphicFromTrails Sketch's graphic <- Playfield's graphic
I think this might be a valuable feature to add generally - that is, making the pen trail's graphic available as a tile. Maybe for the next etoys version.
- Bert -
Scott, Bert,
Thank you both for your verbose help!
Scott: I read in your project file and saw that, sure enough, it allows me to do what I want. I also realized that it actually modified my Squeakland image - and the next time I started Squeak, your project was displayed (and the Navigator and Supplies tabs were missing - although I realize I can toggle them via the world menu). I'm showing my Etoys naivety here, but it'd be nice if, when I start up Squeak again, that the functionality provided by your project was more subtle :)
Bert:
4e. Replace the text shown there:
setGraphicFromTrails self setGraphic: Form3 ===================== with the following (just copy and paste): ===================== setGraphicFromTrails self setGraphic: ((self costume instVarNamed: #turtleTrailsForm) ifNotNilDo: [:f | f trimBordersOfColor: Color transparent]) ===================== Accept using Cmd-s (Alt-s on PC).
FWIW, I'm unable to copy/past into the tile/text field (I'm on Windows). I've attached images of the steps that I take, after manually typing in the code - basically trying to save it - but Alt-s doesn't seem to do it, nor does using the 'Accept' in the menu. So I'm never able to see this tile appear in the Playfield category.
--Randy
Am 26.05.2005 um 17:56 schrieb Randy Heiland:
Bert:
4e. Replace the text shown there:
setGraphicFromTrails self setGraphic: Form3 ===================== with the following (just copy and paste): ===================== setGraphicFromTrails self setGraphic: ((self costume instVarNamed: #turtleTrailsForm) ifNotNilDo: [:f | f trimBordersOfColor: Color transparent]) ===================== Accept using Cmd-s (Alt-s on PC).
FWIW, I'm unable to copy/past into the tile/text field (I'm on Windows). I've attached images of the steps that I take, after manually typing in the code - basically trying to save it - but Alt-s doesn't seem to do it, nor does using the 'Accept' in the menu. So I'm never able to see this tile appear in the Playfield category.
Well it looks like Alt-s worked for you since the indentation changed as it was supposed to. But seemingly you tried to switch back to tile- mode? You should not do this, but stay in text mode. Just hide the script with the "o" button.
The tile will not show up in the "playfield" category, but in the "scripts" category. This is just a regular etoy script (albeit one edited in text mode).
- Bert -
Hi, Randy,
Seemingly you loaded my project into your image, then "saved" your image. Then the next time you started up Squeak you found that it started up looking just like the version you'd "saved."
And yes -- that's what "saving an image" is all about :=)
(Whereas I guess you were hoping that the project's code would remain in the image but the project itself would not?)
Normally, when one loads up a project to check it out, after one is done one simply quits out of Squeak without explicitly "saving" the image. If you "save" an image after loading a project into it -- *any* project -- then the next time you start up that image, it will come up showing that project. This has nothing to do with the particular project I sent out; this will happen if you load *any* project into an image and then save the image...
Anyway -- to undo the effect, either of the following should work:
(a) Start up your altered image. If it opens up showing my project, simply navigate to the *previous* project, *delete* my project from the thumbnail project-view you see there, then save your image again.
(b) Or, alternatively, delete the image, and download a fresh one from Squeakland.
Sorry for any misunderstandings about this. I sent my changes out as a project file rather than as a change-set simply so that more people would easily be able to try it out, not for people to "save" within their permanent, ongoing Squeak iamges.
Cheers,
-- Scott
At 10:56 AM -0500 5/26/05, Randy Heiland wrote:
Scott: I read in your project file and saw that, sure enough, it allows me to do what I want. I also realized that it actually modified my Squeakland image - and the next time I started Squeak, your project was displayed (and the Navigator and Supplies tabs were missing - although I realize I can toggle them via the world menu). I'm showing my Etoys naivety here, but it'd be nice if, when I start up Squeak again, that the functionality provided by your project was more subtle :)
Bert:
4e. Replace the text shown there:
setGraphicFromTrails self setGraphic: Form3 ===================== with the following (just copy and paste): ===================== setGraphicFromTrails self setGraphic: ((self costume instVarNamed: #turtleTrailsForm) ifNotNilDo: [:f | f trimBordersOfColor: Color transparent]) ===================== Accept using Cmd-s (Alt-s on PC).
FWIW, I'm unable to copy/past into the tile/text field (I'm on Windows). I've attached images of the steps that I take, after manually typing in the code - basically trying to save it - but Alt-s doesn't seem to do it, nor does using the 'Accept' in the menu. So I'm never able to see this tile appear in the Playfield category.
--Randy
Attachment converted: titanium:editScript-1.jpg (JPEG/prvw) (001BCB0A) Attachment converted: titanium:editScript-2.jpg (JPEG/prvw) (001BCB0B) Attachment converted: titanium:editScript-3.jpg (JPEG/prvw) (001BCB0C)
squeakland@lists.squeakfoundation.org