anybody looked at Boost.Python ?

Hi,

I understand that the current wxPython uses a modified version of SWIG.
Did you looked into Boost ? Wouldn't be easier to use Boos.Python to
create the bindings for Python ?

Can I make some classes with wxWindows and wrapp with Boost.Python and
combine with the existing wxPython ones even if the current ones are
made with SWIG ?

Ionutz

Ionutz Borcoman wrote:

Hi,

I understand that the current wxPython uses a modified version of SWIG.
Did you looked into Boost ? Wouldn't be easier to use Boos.Python to
create the bindings for Python ?

I've looked at it. The main issue is that wxPython was already a few years old when Boost.Python appeared and so it would be very painful to switch. Not only for me but for you users as well because there will undoubtedly be many subtle differences.

If I were to start the project today (or even a couple years ago) then I would probably use Boost.

Can I make some classes with wxWindows and wrapp with Boost.Python and
combine with the existing wxPython ones even if the current ones are
made with SWIG ?

No. The SWIG type system would not recognise that your Boost wrapped classes derive from the base classes in wxPython, and so they would not integrate well, if at all.

···

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

Does anyone have a link to a tutorial on drawing on the canvas and dealing with
mouse issues as far as clicking on objects that are drawn. Starting to work with
this and looking at some tutorials would really be useful.

  Thanks

Mike Wagman wrote:

Does anyone have a link to a tutorial on drawing on the canvas and dealing with mouse issues as far as clicking on objects that are drawn. Starting to work with this and looking at some tutorials would really be useful.

We don't have a general purpose canvas yet, but you may find the wxOGL library helpful, it has a sample in the demo. Also look at the wxDragImage sample.

···

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

Mike Wagman wrote:
> Does anyone have a link to a tutorial on drawing on the canvas and dealing with
> mouse issues as far as clicking on objects that are drawn. Starting to work with
> this and looking at some tutorials would really be useful.

There is some stuff in the Wiki here:

http://wiki.wxpython.org/index.cgi/RecipesImagesAndGraphics

By the way, if you send a description of what you need to do, one of us
may have done something similar that we can lend you.

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer
                                        
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

Ok I am writing a turn based strategy game that uses a hex map. I want
to display a 7x7 grid of polygons (hex's) and then identify which
polygon was right or left clicked on. I also need to be able to modify
the attributes of each hex as they will change as you scroll the map
around. I plan on putting a text object over each hex to indicates it's
coordinates.

BTW I have written two programs that allow you to configure 180+ option
(all set to default) using pretty standard - text entry, sliders,
clickables. Written config files and done pen and paper playtesting of
the game mechanics. I also have been working with wxpython for about a
month and not done any serious programming since I wrote a freeware game
for the C64.

···

By the way, if you send a description of what you need to do, one of us
may have done something similar that we can lend you.

-Chris

--
Mike Wagman <mwagman@charter.net>

wxOGL is the way I am planing on going just don't know enough about it
yet. (input seems to elude me)

···

We don't have a general purpose canvas yet, but you may find the wxOGL
library helpful, it has a sample in the demo. Also look at the
wxDragImage sample.

--
Mike Wagman <mwagman@charter.net>

I've been debating about pygame and I have hit there site extensively.
However unless I am mistaken I cannot open a SDL window in a panel,
which is the format I would prefer to use which is why I was considering
wxOGl. Am I mistaken can I open and reference a SDL window in a panel if
so could someone send me the base code.

···

On Thu, 2003-06-12 at 20:59, Chuck Esterbrook wrote:

On Thursday 12 June 2003 05:50 pm, Mike Wagman wrote:
> Ok I am writing a turn based strategy game that uses a hex map. I
> want to display a 7x7 grid of polygons (hex's) and then identify
> which polygon was right or left clicked on. I also need to be able
> to modify the attributes of each hex as they will change as you
> scroll the map around. I plan on putting a text object over each hex
> to indicates it's coordinates.

In case you haven't already heard of it, you'll want to check these guys out:
  http://pygame.org/

--
Mike Wagman <mwagman@charter.net>

Mike Wagman wrote:

Ok I am writing a turn based strategy game that uses a hex map. I want
to display a 7x7 grid of polygons (hex's) and then identify which
polygon was right or left clicked on. I also need to be able to modify
the attributes of each hex as they will change as you scroll the map
around. I plan on putting a text object over each hex to indicates it's
coordinates.

If OGL or PyGame work for you, great. Otherwise, this wouldn't be too
hard to do with wxDCs and drawing on a wxPanel or wxScrolledwindow. what
you would need to do is write a "hit test" function that determines what
polygon was clicked on. I know of two fairly simple ways to do this. One
is to get the coordinates of the mouse click, and then compute a
point-in-polygon test for each polygon, to see if it was clicked on. If
you have the polygons arranged in a grid, you should be able to figure
out which ones are close very easily, and then do the test. Code for hte
poin in polygon test can be found at:

THe code is here:
http://www1.acm.org/pubs/tog/GraphicsGems/gemsiv/ptpoly_haines/

It's in C, but wouldn't be hard to translate to Python. I've included in
a C python extension that I wrote , if you want that, but it would
probably be plenty fast in Python anyway.

Another method is a nifty trick that was discussed recetnly on this
list. When you draw your polygons to the screen, draw another copy to an
off-screen bitmap (with a wxMemoryDC), but with each polygon in a
different color. Then when you get the mouser coordinates, you can do a
wxDC.GetPixel(x,y), which will return the color, which you can map to
the polygon. This is very fast, and makes it easy to draw lots of
different shapes without having to write specific hit test code.

I had a test of this method worked up, but I cna't find it at the
moment. I am planning on implimenting it for a project of mine, so if
you're interested I can help you out. If you search the recent archives,
you'll find someone who did a simple version of this using PythonCard,
and posted a link to his code.

Good luck,

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer
                                        
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov