Code Comments
Programming Forum and web based access to our favorite programming groups.I would appreciate any help on what to put in the following code to place points, lines, ovals, or polygons on the canvas. I know it is not that difficult but it eludes me and i do need the imformation badly. I have looked at the samples in the tutorial but something still doesnt click. I think it is as below but i need the general code. i do not want to draw with the mouse what i need to do is place a line, point, polygon, or oval at a precise point in the canvas using the create command and have it show me the object in the canvas. (create <line> canvas x1 y1 x2 y2 more...) where i will compute the coordinates by function calls. I realize this is probably very minor to you but it is very important to me and so i think it is something simple as below where just a few lines need to be added. (is there a create class: point or pixel?) (module () (import swl:oop) (import swl:macros) (import swl:generics) (import swl:option) (let* ([top (create <toplevel> with (title: "Canvas Example"))] what goes here to get what I need respectfully submitted madmountain
Post Follow-up to this messagemadman wrote: > I would appreciate any help on what to put in the following code to > place points, lines, ovals, or polygons on the canvas. I know it is not > that difficult but it eludes me and i do need the imformation badly. I > have looked at the samples in the tutorial but something still doesnt > click. I think it is as below but i need the general code. i do not > want to draw with the mouse what i need to do is place a line, point, > polygon, or oval at a precise point in the canvas using the create > command and have it show me the object in the canvas. (create <line> > canvas x1 y1 x2 y2 more...) where i will compute the coordinates by > function calls. > I realize this is probably very minor to you but it is very important > to me and so i think it is something simple as below where just a few > lines need to be added. (is there a create class: point or pixel?) Is this enough to get you started? (module () (import swl:oop) (import swl:macros) (import swl:generics) (import swl:option) (define (random-color) (make <rgb> (random 255) (random 255) (random 255))) (let* ([top (create <toplevel> with (title: "Canvas Example"))] [canvas (create <canvas> top with (background-color: (make <rgb> 215 215 255)))] [shapes (list (create <rectangle> canvas 10 10 100 100) (create <oval> canvas 100 20 300 200) (create <polygon> canvas 10 10 30 40 70 20))]) (for-each (lambda (shape) (set-outline-color! shape (random-color)) (show shape)) shapes) (show canvas) top))
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.