[racket] image on frame

From: Sean McBeth (sean.mcbeth at gmail.com)
Date: Wed Apr 24 06:25:10 EDT 2013

"Multiple 50x50 images" sounds like you are trying to make a game.
On Apr 24, 2013 2:00 AM, "Laurent" <laurent.orseau at gmail.com> wrote:

> It works for me (Ubuntu), replacing your pictures with strings, although
> the placement is probably not what you'd expect: it is not
> top-left-position based and the margin depends on the previous elements.
>
> You can put all the images inside a panel% instead of directly into the
> frame: all the containees are superimposed in a panel%, so the margins will
> work as you expect.
>
> Or you can create horizontal panels containing vertical panels and just
> place the images one after the other in each vertical panel.
>
> Or you can use a canvas% to display the images at specific locations, but
> this is a somewhat different approach.
>
> Laurent
>
>
> On Wed, Apr 24, 2013 at 4:53 AM, Alan Johnsey <a.johnsey at cox.net> wrote:
>
>> Thanks for this example.  I'm trying to load multiple 50x50 ".bmp" images
>> into a frame, specifying both the horizontal and vertical positions.
>> Specifying the horiz-margin for a message works fine, but the vert-margin
>> does not. Is this an error, or am I missing something? I'm using Racket
>> 3.3.
>>
>> Sample code:
>>
>> #lang racket/gui
>> (define xmax 12)
>> (define ymax 10)
>>
>> (define f (new frame% [label "This Space For Rent"]
>>                [height (* 50 ymax)]
>>                [width (* 50 xmax)]
>>                [alignment '(left top)]
>>                ))
>>
>> (define l (new message% [parent f]
>>                [vert-margin 0]
>>                [horiz-margin 0]
>>                [label (make-object bitmap% "x.bmp")]))
>>
>>
>> (set! l (new message%
>>              [parent f]
>>              [vert-margin 0]
>>              [horiz-margin 50]
>>              [label (make-object bitmap% "y.bmp")]))
>>
>> (set! l (new message%
>>              [parent f]
>>              [vert-margin 50]
>>              [horiz-margin 0]
>>              [label (make-object bitmap% "z.bmp")]))
>>
>>
>> (send f show #t)
>>
>>
>> -----Original Message-----
>> From: users-bounces at racket-lang.org [mailto:users-bounces at racket-lang.org
>> ]
>> On Behalf Of Michael Wilber
>> Sent: Tuesday, April 16, 2013 9:20 AM
>> To: deepak verma; users
>> Subject: Re: [racket] image on frame
>>
>> Try something like:
>>
>>     #lang racket/gui
>>     (require racket/draw)
>>     (define f (new frame% [label "This Space For Rent"]))
>>     (define l (new message% [parent f]
>>                             [label (make-object bitmap%
>> "/tmp/130414_005.jpg")]))
>>     (send f show #t)
>>
>> deepak verma <deepakverma14021994 at gmail.com> writes:
>> > how can we show a image on frame ?
>> > ____________________
>> >   Racket Users list:
>> >   http://lists.racket-lang.org/users
>> ____________________
>>   Racket Users list:
>>   http://lists.racket-lang.org/users
>>
>>
>> ____________________
>>   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/20130424/27fc5ced/attachment-0001.html>

Posted on the users mailing list.