[wxPython] simple problem

I’ve adapted the code that comes with the demo that deails with dragging images around on the screen. Acording to what I understand this should work:

self.bg_bmp = wxBitmap(name = “images/bg.gif”, type = wxBITMAP_TYPE_GIF)

But I get invalid bitmap errors. Converting the image to a bitmap directly and using:

self.bg_bmp = wxBitmap(name = “images/bg.bmp”) works ok. What am I doing wrong?

Also I noticed there is also a DragImage class in the documentation. Does this work as good or better than the code provided in the demo?

Thanks

Joel

I've adapted the code that comes with the demo that deails
with dragging images around on the screen. Acording to what
I understand this should work:

self.bg_bmp = wxBitmap(name = "images/bg.gif", type =
wxBITMAP_TYPE_GIF)

But I get invalid bitmap errors.

Do you call wxInitAllImageHandlers() in your app's startup?

Also I noticed there is also a DragImage class in the
documentation. Does this work as good or better than the
code provided in the demo?

Isn't that waht the demo using? Or are you looking at a different sample in
the demo?

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

I’ve adapted the code that comes with the demo that deails with dragging images around on the screen. Acording to what I understand this should work:

You should probably call this before you init the first frame of your app:

Initializing the image handlers allows the program to

use images in far more formats than just bitmaps.

wxInitAllImageHandlers()

Also I noticed there is also a DragImage class in the documentation. Does this work as good or better than the code provided in the demo?

There is a demo for wxDragImage as well, and it works as expected.

···

Do you call wxInitAllImageHandlers() in your app's startup?

Nope, I sure didn't. That did the trick. Thanks.

Isn't that waht the demo using? Or are you looking at a different sample

in

the demo?

The sample is called wxDragImage, found under Micellaneous, but it appears
to me that the code is maybe an old way of dragging images? Before the code
was encapsulated into wxDragImage?

Joel

···

----- Original Message -----
From: "Robin Dunn" <robin@alldunn.com>

> Isn't that waht the demo using? Or are you looking at a different

sample

in
> the demo?

The sample is called wxDragImage, found under Micellaneous, but it appears
to me that the code is maybe an old way of dragging images? Before the

code

was encapsulated into wxDragImage?

Look closer. The demo/wxDragImage.py module is a demo that shows how to use
the wxDragImage class, (one possibility anyhow.) Most of them are that way.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!