wxPython | Mac X11 version

Hi,

I'm working on porting PythonOCC to OSX.
PythonOCC is a python wrapper for OpenCASCADE, the open source CAD kernel.

Thing is that OpenCASCADE gui is based on X11.
Sure X11 is supported, what I do not know is how this works again with WX.
Can I use WX with X11 on the mac?
Is there a way to inform WX to use X11 rather than Aqua?
Any pointers in how I might do so are *much* appreciated.

Best regards,

-jelle

Hello,

Hi,

I'm working on porting PythonOCC to OSX.
PythonOCC is a python wrapper for OpenCASCADE, the open source CAD kernel.

Thing is that OpenCASCADE gui is based on X11.
Sure X11 is supported, what I do not know is how this works again with WX.
Can I use WX with X11 on the mac?
Is there a way to inform WX to use X11 rather than Aqua?
Any pointers in how I might do so are *much* appreciated.

Is the application written using x11 or an x11 based toolkit like gtk?

Are you porting the application to wx (re-writing the ui)? If so then there is no need to tell it to use x11 as it can use a regular mac ui. If not, and its not written with wx then I guess I am a little confused by your question and how this relates to wx...

If its a regular x11 app then you should be able to just run it if you have the x11 window manager app installed. Just use the python installed from fink or macports instead of the mac installed one.

Cody

···

On Jan 12, 2009, at 6:27 AM, Jelle wrote:

Hi Cody,

Thanks for your reply.

Is the application written using x11 or an x11 based toolkit like gtk?

Its a little more low level than that.
Here's what's going on:

    printf("Display3d class initialization starting ...\n");
  short hi = static_cast<short>(window_handle >> 16);
  short lo = static_cast<short>(window_handle);
  // Create Graphic Device and Window
  #ifdef WNT
  gd = new Graphic3d_WNTGraphicDevice();
  printf("WNT Graphic device created.\n");
  myWindow = new WNT_Window( gd
,static_cast<Standard_Integer>(hi),static_cast<Standard_Integer>(lo));
  printf("WNT window created.\n");
  #else

# This is the case, since we're on osx
# its returning a X11 rather than aqua handle.
# hence, I'm curious to know whether WX can deal with this handle.

  gd = new Graphic3d_GraphicDevice(std::getenv("DISPLAY"));
  printf("Graphic device created.\n");
  myWindow =new
Xw_Window(gd,static_cast<Standard_Integer>(hi),static_cast<Standard_Integer>\
(lo),Xw_WQ_SAMEQUAL
ITY);
  printf("Xw_Window created.\n");
  #endif
  // Create V3dViewer and V3d_View

Now, the following link made me think about the above:
http://qtocc.wiki.sourceforge.net/opencascade_osx

At the paragraph "Compiling Qt Tutorial sample application" it states:

`At the moment, it seems to be impossible to use OpenCASCADE
outside of the X11 system. This implies that to use Qt, you need to
use the Qt/X11 version instead of the Qt/mac version`

Therefore, I'm thinking I should do something similar
when developing the WX gui.

Are you porting the application to wx (re-writing the ui)? If so then
there is no need to tell it to use x11 as it can use a regular mac ui.

Well that's the thing; OCC cannot run outside of the X11 enviroment.

If not, and its not written with wx then I guess I am a little
confused by your question and how this relates to wx...

Well, from what I've understood, QT has a mac native version,
as well as a X11 version. How does this map to WX?
Is there a X11 version of WX too?

Sorry if my question wasnt well formulated; this is new territory for me...

If its a regular x11 app then you should be able to just run it if you
have the x11 window manager app installed. Just use the python
installed from fink or macports instead of the mac installed one.

I've lost you here.
I've installed the X11.app, but why would I need to change interpreters for?
(XQuartz)

Thanks,

-jelle

Hello,

Are you porting the application to wx (re-writing the ui)? If so then

there is no need to tell it to use x11 as it can use a regular mac ui.

Well that’s the thing; OCC cannot run outside of the X11 enviroment.

If not, and its not written with wx then I guess I am a little

confused by your question and how this relates to wx…

Well, from what I’ve understood, QT has a mac native version,

as well as a X11 version. How does this map to WX?

Is there a X11 version of WX too?

There is wxX11 but there is currently no wxPython version that supports that port of wxWidgets (I also haven’t used the x11 port before but I suspect its not as well maintained as the main 3.).

Sorry if my question wasnt well formulated; this is new territory for me…

If its a regular x11 app then you should be able to just run it if you

have the x11 window manager app installed. Just use the python

installed from fink or macports instead of the mac installed one.

I’ve lost you here.

I’ve installed the X11.app, but why would I need to change interpreters for?

(http://xquartz.macosforge.org/trac/wiki)

I would try installing all of its dependencies through fink and see if you can build it with the gnu tool chain, the libraries installed by fink are for x11. If it builds and your lucky you should (most likely) be able to run it.

Cody

···

On Mon, Jan 12, 2009 at 7:58 AM, Jelle jelleferinga@gmail.com wrote:

There is wxX11 but there is currently no wxPython version that supports
that port of wxWidgets
(I also >haven't used the x11 port before but I suspect its not as well
maintained as the main 3.).

Thanks a lot Cody, that's the answer I was looking for.

Thanks again,

-jelle

Jelle wrote:

There is wxX11 but there is currently no wxPython version that supports
that port of wxWidgets
(I also >haven't used the x11 port before but I suspect its not as well maintained as the main 3.).

Thanks a lot Cody, that's the answer I was looking for.

Also, the GTK version of wx has been built on OS X before. If I needed an X version of wx/wxPython on Mac then that is probably the route I would try first.

···

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

Hello,

···

On Mon, Jan 12, 2009 at 10:52 AM, Robin Dunn robin@alldunn.com wrote:

Jelle wrote:

There is wxX11 but there is currently no wxPython version that supports

that port of wxWidgets

(I also >haven’t used the x11 port before but I suspect its not as well maintained as the main 3.).

Thanks a lot Cody, that’s the answer I was looking for.

Also, the GTK version of wx has been built on OS X before. If I needed an X version of wx/wxPython on Mac then that is probably the route I would try first.

I used to do that until I had decent enough vm software to not need to anymore. I wrote up some very rough instructions on how to do it in the wiki http://wiki.wxpython.org/wxGTK%20on%20Mac%20OSX (Note: these were notes written from memory after a lot of trial and error to get it to build and run propery. So there may be some stuff missing…)

Cody

Jelle wrote:

There is wxX11 but there is currently no wxPython version that supports
that port of wxWidgets
(I also >haven't used the x11 port before but I suspect its not as well maintained as the main 3.).

Thanks a lot Cody, that's the answer I was looking for.

He's referring to the plain X11 version. There is also the wxGTK version, which is built on GTK, which is built on X, and you may well be able to pass X11 window handles around to/from other X11 code ( at least with a bit of C/C++ hacking). I think I saw some thing about this on this list in the last couple of months, as a matter of fact.

This is assuming that you want to use some code that draws to an X11 window, but you want to write the rest of the GUI in wxPython.

I've lost you here.
I've installed the X11.app, but why would I need to change interpreters for?

You don't -- but you do need wxGTK, and that's probably easier to get via fink and/or macports.

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (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

This is assuming that you want to use some code that draws to an X11
window, but you want to write the rest of the GUI in wxPython.

Yup, that's exactly what I need.

You don't -- but you do need wxGTK, and that's probably easier to get
via fink and/or macports.

True, it installed right out of the box with macports, though the opengl version
fails somehow.

Thanks,

-jelle

Hi all,

Cody, I followed your instructions on compiling wxPython-wxGTK and you're
too modest: following your instructions it was actually pretty easy.

I had a similar issue trying to link cairo, but `export=${LDFLAGS} -lcairo`
did not solve that for me, for the rest it was cool, thanks!

Now, the reason why I'm interested in wxPython-wxGTK is because I'm working
on porting PythonOCC to osx. OpenCASCADE(.org) wants to draw in X11, hence
I'm using this version.

I did not manage to compile the wxPython-wxGTK with opengl, judging from
your --without-opengl flag you had similar issues. Since OCC heavily relies on
opengl that's probably an issue.

Has anyone of you been able to do so?

Much appreciated,

-jelle

Hello,

···

On Tue, Jan 13, 2009 at 10:54 AM, Jelle jelleferinga@gmail.com wrote:

Hi all,

Cody, I followed your instructions on compiling wxPython-wxGTK and you’re

too modest: following your instructions it was actually pretty easy.

I had a similar issue trying to link cairo, but export=${LDFLAGS} -lcairo

did not solve that for me, for the rest it was cool, thanks!

Now, the reason why I’m interested in wxPython-wxGTK is because I’m working

on porting PythonOCC to osx. OpenCASCADE(.org) wants to draw in X11, hence

I’m using this version.

I did not manage to compile the wxPython-wxGTK with opengl, judging from

your --without-opengl flag you had similar issues. Since OCC heavily relies on

opengl that’s probably an issue.

Has anyone of you been able to do so?

I didn’t even try with opengl. I disabled it because I had no use for it and figured it would be just another hurdle to jump over. I would think it should be doable though. What kind of compiler/link errors did you get?

Cody

Jelle wrote:

This is assuming that you want to use some code that draws to an X11 window, but you want to write the rest of the GUI in wxPython.

Yup, that's exactly what I need.

except that it looks like you are really drawing with OpenGL -- maybe you don't need X11, but rather just wxPyOpenGL.

What is it using X11 itself for?

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (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