Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: wxWidgets  (Read 7147 times)

0 Members and 2 Guests are viewing this topic.

zill

  • Newbie
  • *
  • Posts: 12
    • View Profile
wxWidgets
« on: March 24, 2009, 02:19:17 am »
I had no problem following the documentation to get wxWidgets to work with SFML.  However, I'm having some issues getting wxWidgets to work with PySFML.  It's basically the same thing.  I'm just much more used to the C++ syntax than Python, so I'm having some issues.

Has anyone been able to get PySFML and wxWidgets working?  Would you care to share the code?

Thank you

zill

  • Newbie
  • *
  • Posts: 12
    • View Profile
wxWidgets
« Reply #1 on: March 29, 2009, 05:29:57 am »
It appears this isn't possible to do from an all Python perspective.  From what I've read, it is impossible to get the gtk.gdk.Window pointer necessary to set up the SFML render window.

Does anyone have a suggestion?

remi.k2620

  • Full Member
  • ***
  • Posts: 186
    • View Profile
    • http://remi.tuxfamily.org
wxWidgets
« Reply #2 on: March 29, 2009, 03:40:02 pm »
Quote from: "zill"
It appears this isn't possible to do from an all Python perspective.  From what I've read, it is impossible to get the gtk.gdk.Window pointer necessary to set up the SFML render window.

Does anyone have a suggestion?


Are you talking about the window handle ? There is a GetHandle function : http://www.wxpython.org/docs/api/wx.Window-class.html#GetHandle
I didn't implement the constructor that uses a windowhandle, since the handle can be an integer or a void pointer, which doesn't exist in python. However, since this function returns a long int, I just implemented the constructor (you'll need the latest sources from svn), taking a long int as argument and casting it to a sf::WindowHandle. I can't guarantee it will work, but if it doesn't it is probably a problem of conversion between types.

Edit: I think I didn't undestand well your problem, you're having troubles translating this into python:
Code: [Select]

    #ifdef __WXGTK__



        // GTK implementation requires to go deeper to find the low-level X11 identifier of the widget

        gtk_widget_realize(m_wxwindow);

        gtk_widget_set_double_buffered(m_wxwindow, false);

        GdkWindow* Win = GTK_PIZZA(m_wxwindow)->bin_window;

        XFlush(GDK_WINDOW_XDISPLAY(Win));

        sf::RenderWindow::Create(GDK_WINDOW_XWINDOW(Win));



    #else

?

zill

  • Newbie
  • *
  • Posts: 12
    • View Profile
wxWidgets
« Reply #3 on: March 31, 2009, 05:24:01 am »
Yes, this same problem effects Ogre3d also.  It appears there is no way to do this without writing a C module for python.

 

anything