Hi, Yeah, if you want to draw some text that's fine. But even if you want to import an image that has a transparent background onto a drawing canvas, it does not support the transparency. It adds a background color. So that doesn't work either.
But that is not really my current issue. What I want to achieve is create a GUI for a game. So, what I want to do is have a main frame with a background image. After that I create a bunch of menu's, like the main menu where you can select "New game", "Load game", ... If you press one of the buttons the main menu disappears and a new menu appears and so on. Now what I want is the background to always stay the same. Ok, all that is doable with panels. No problem, except that a panel has a grey background and hides the background beneath it. Same goes for input-fields, if you want the user to enter a name or something, or buttons with transparent backgrounds. So what I have to do to get around the problem for the menu's is this: I create a panel, add the background to it and then add a pane (not a panel) and then add the menu to the pane. A pane does have transparency, but cannot be deleted. So I have to delete the whole panel with the background to show a new menu. But that means I have to reload the background each time for a new menu. For the buttons and such with transparent images I haven't found a solution yet. (I don't know if this is the correct way to code in scheme, I just started using it) (define mainFrame (new frame% ...)) (send mainFrame show #t) (define addMainMenu (lambda (container) (let* ([panel (new panel% [parent container])] [background (addBackground panel (make-object bitmap% "images/main-background.jpg"))] [menu (addVerticalPane panel 10 800 600)]) (addVerticalSpace menu 300) (addButton menu "New Game" (lambda (button event) (begin (send container delete-child panel) (chooseCharacter container)))) (addButton menu "Load Game" (lambda (button event) (...))) (addButton menu "Options" (lambda (button event) (...))) (addButton menu "Exit" (lambda (button event) (exit)))))) (define chooseCharacter (lambda (container) (let* ([panel (new panel% [parent container])] [background (addBackground panel (make-object bitmap% "images/main-background.jpg"))] [menu (addVerticalPane panel 10 800 600)]) (addVerticalSpace menu 75) ...))) (addMainMenu mainFrame) Cheers, Chris -----Original Message----- From: Noel Welsh [mailto:noelwe...@gmail.com] Sent: woensdag 20 oktober 2010 22:40 To: Christophe Vandenberghe Cc: users@racket-lang.org Subject: Re: [racket] Transparent area's Hi, My recollection is that the current graphics toolkit has limited support for transparency, but it should work for drawing text on an image. Can you send a small example illustrating the problem? Cheers, N. On Mon, Oct 18, 2010 at 2:07 PM, Christophe Vandenberghe <chv...@gmail.com> wrote: > I am fairly new to scheme and I have been experimenting with the Graphics > Toolkit from Racket. > > I am trying to work with a background image and have everything else be on > top of that image. The problem is that most areas come with a grey > background that I cant seem to get rid of.... _________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users