From: Kevin A. <al...@se...> - 2005-12-12 22:54:44
|
What you want to do is use the BitmapCanvas component to do your=20 drawing after you load your existing image. Both the loading and saving=20= are shown in the doodle sample so I suggest basing your own application=20= on the doodle sample. The saving is handled using a helper function=20 from the graphic module so you don't have to hardcode the wxWidgets=20 graphics filetype and a wxWidgets/wxPython method call: from PythonCard import graphic # make sure you have this in your code path =3D 'some.png' # your filename/path here fileType =3D graphic.bitmapType(path) bmp =3D self.components.bufOff.getBitmap() # change to whatever your=20 BitmapCanvas is named bmp.SaveFile(path, fileType) If you're really in a hurry, you can always just use the doodle sample=20= to load an image, do your drawing in the shell window (start the=20 program with the -s command line option) and then use the File->Save=20 As... menu item. ka On Nov 29, 2005, at 8:13 AM, Mauro Cherubini wrote: > Dear All, > > sorry for the newbie question but I am fighting with the following=20 > issue: > I am trying to add some drawing on top of an existing bitmap. > I tried two things: the first one was to draw directly on the image=20 > setting that as the working canvas (i.e., canvas =3D=20 > self.components.canvasBackground); the second was to draw on a=20 > separate canvas. > > The first attempt raised an exception because apparently is not=20 > possible to draw on bitmaps. The second attempt load the drawing=20 > canvas on top of the "background" bitmap and because it is not=20 > transparent it covers automatically the background. > > I tried to set the 'backgroundColor' to 'None' but without success (it=20= > says that 'AttributeError: 'BitmapCanvas' object has no attribute=20 > 'backgroundColour''). > > Does anybody can help me to knock my head on the right place? > Thanks in advance for the pain you will generously cause > > > Mauro > > > _______________ > Mauro Cherubini > Research Associate > Centre de Recherche et d'Appui pour la Formation et ses Technologies=20= > (CRAFT) / Center for Research and Support of Training and its=20 > Technologies > > Ecole Polytechnique F=E9d=E9rale de Lausanne (EPFL) / Swiss Federal=20 > Institute of Technology Lausanne > web: http://craft.epfl.ch -- blog:=20 > http://www.i-cherubini.it/mauro/blog/ |