wxwebkit python bindings : NotImplementedError after build

Hello everyone,

I wanted to use wxwebkit but I got a NotImplementedError when trying to use wx.webkit.WebKitCtrl().
I saw that there is a wxwebkit page here: http://wxwebkit.wxcommunity.com and decided to build it as maybe
it wasn't build, I built wxwebkit on ubuntu like so :

sudo apt-get install gcc g++ flex bison gperf libxml2 libxslt1.1 libxslt1-dev libcurl4-openssl-dev libsqlite3-dev libpng12-dev libjpeg62-dev libpango1.0-dev libgtk2.0-dev subversion

$ cd ~/tmp
$ git clone git://gitorious.org/wxwebkit/wxwebkit.git
$ cd wxwebkit/WebKitTools/Scripts
$ ./build-webkit --wx --makeargs="-j2 --wxpython"
$ cd ~/tmp/wxwebkit/WebKitBuild/Debug.master
$ chmod +x libwxwebkit.so
$ sudo cp libwxwebkit.so /usr/lib/
$ ./wxBrowser

that works, then I wanted to try the pythin bindings :

$ cd ~/tmp/wxwebkit/WebKit/wx/bindings/python/build/default
$ python
Python 2.5.2 (r252:60911, Jul 22 2009, 15:35:03)
[GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx
>>> wx.version()
'2.8.10.1 (gtk2-unicode)'
>>> import wx.webkit
>>> app = wx.PySimpleApp()
>>> frame = wx.Frame(None)
>>> web = wx.webkit.WebKitCtrl(frame)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.5/site-packages/wx-2.8-gtk2-unicode/wx/webkit.py", line 72, in __init__
    _webkit.WebKitCtrl_swiginit(self,_webkit.new_WebKitCtrl(*args, **kwargs))
NotImplementedError

as you can see I'm still getting this error. Do I also have to build wxPython for it to work? If so once I have built it and finished the final steps :

$ python setup.py build_ext --inplace BUILD_GLCANVAS=0 BUILD_STC=0 BUILD_GIZMOS=0 WX_CONFIG=/tmp/wx/2.8/bin/wx-config
$ python setup.py install BUILD_GLCANVAS=0 BUILD_STC=0 BUILD_GIZMOS=0 WX_CONFIG=/tmp/wx/2.8/bin/wx-config

how do I get wxwebkit to integrate into wx? I didn't see a setup.py for it. I also wonder if it's necessary to buils wxwebkit if I build wxpython as wouldn't it be built directly by it?

Thank you,
Gabriel

Hi Gabriel,

Hello everyone,

I wanted to use wxwebkit but I got a NotImplementedError when trying to
use wx.webkit.WebKitCtrl().
I saw that there is a wxwebkit page here:
http://wxwebkit.wxcommunity.com and decided to build it as maybe
it wasn't build, I built wxwebkit on ubuntu like so :

sudo apt-get install gcc g++ flex bison gperf libxml2 libxslt1.1
libxslt1-dev libcurl4-openssl-dev libsqlite3-dev libpng12-dev
libjpeg62-dev libpango1.0-dev libgtk2.0-dev subversion

$ cd ~/tmp
$ git clone git://gitorious.org/wxwebkit/wxwebkit.git
$ cd wxwebkit/WebKitTools/Scripts
$ ./build-webkit --wx --makeargs="-j2 --wxpython"
$ cd ~/tmp/wxwebkit/WebKitBuild/Debug.master
$ chmod +x libwxwebkit.so
$ sudo cp libwxwebkit.so /usr/lib/
$ ./wxBrowser

that works, then I wanted to try the pythin bindings :

$ cd ~/tmp/wxwebkit/WebKit/wx/bindings/python/build/default
$ python
Python 2.5.2 (r252:60911, Jul 22 2009, 15:35:03)
[GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import wx
wx.version()

'2.8.10.1 (gtk2-unicode)'

import wx.webkit
app = wx.PySimpleApp()
frame = wx.Frame(None)
web = wx.webkit.WebKitCtrl(frame)

That should be

import wx.webview
web = wx.webview.WebView(frame)

Note that you need to add ~/tmp/wxwebkit/WebKitBuild/Debug.master to your PYTHONPATH and LD_LIBRARY_PATH for things to work.

wx.webkit.WebKitCtrl wraps Safari on Mac, it is not a cross-platform control and it predates the cross-platform wxWebKit project.

Perhaps in 2.9/3.0 we should deprecate this syntax and instead use something like wx.safari.SafariMacCtrl() to make things clearer...

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File
"/usr/lib/python2.5/site-packages/wx-2.8-gtk2-unicode/wx/webkit.py",
line 72, in __init__
   _webkit.WebKitCtrl_swiginit(self,_webkit.new_WebKitCtrl(*args,
**kwargs))
NotImplementedError

as you can see I'm still getting this error. Do I also have to build
wxPython for it to work? If so once I have built it and finished the
final steps :

$ python setup.py build_ext --inplace BUILD_GLCANVAS=0 BUILD_STC=0
BUILD_GIZMOS=0 WX_CONFIG=/tmp/wx/2.8/bin/wx-config
$ python setup.py install BUILD_GLCANVAS=0 BUILD_STC=0 BUILD_GIZMOS=0
WX_CONFIG=/tmp/wx/2.8/bin/wx-config

how do I get wxwebkit to integrate into wx? I didn't see a setup.py for
it. I also wonder if it's necessary to buils wxwebkit if I build
wxpython as wouldn't it be built directly by it?

Yes, wxPython does not include the cross-platform wxWebKit. I hope to spend some more time working out the issues with Ubuntu binaries soon.

Thanks,

Kevin

···

On Dec 14, 2009, at 4:49 AM, Gabriel Rossetti wrote:

Thank you,
Gabriel

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

The wx.webkit.WebKitCtrl wrapper bindings included in wxPython are
only available on the Mac because it wraps a native control. On all
other platforms, you'll get an exception if you try to use it.

wxWebKit is a different (more cross-platform) project, and appears to
have a completely different set of bindings. Looks like there's a
sample available here:

http://gitorious.org/wxwebkit/wxwebkit/blobs/master/WebKit/wx/bindings/python/samples/simple.py

James

···

On Dec 14, 7:49 am, Gabriel Rossetti <gabriel.rosse...@arimaz.com> wrote:

Hello everyone,

I wanted to use wxwebkit but I got a NotImplementedError when trying to
use wx.webkit.WebKitCtrl().

Hi Kevin,

Kevin Ollivier wrote:

Hi Gabriel,

Hello everyone,

I wanted to use wxwebkit but I got a NotImplementedError when trying to use wx.webkit.WebKitCtrl().
I saw that there is a wxwebkit page here: http://wxwebkit.wxcommunity.com and decided to build it as maybe
it wasn't build, I built wxwebkit on ubuntu like so :

sudo apt-get install gcc g++ flex bison gperf libxml2 libxslt1.1 libxslt1-dev libcurl4-openssl-dev libsqlite3-dev libpng12-dev libjpeg62-dev libpango1.0-dev libgtk2.0-dev subversion

$ cd ~/tmp
$ git clone git://gitorious.org/wxwebkit/wxwebkit.git
$ cd wxwebkit/WebKitTools/Scripts
$ ./build-webkit --wx --makeargs="-j2 --wxpython"
$ cd ~/tmp/wxwebkit/WebKitBuild/Debug.master
$ chmod +x libwxwebkit.so
$ sudo cp libwxwebkit.so /usr/lib/
$ ./wxBrowser

that works, then I wanted to try the pythin bindings :

$ cd ~/tmp/wxwebkit/WebKit/wx/bindings/python/build/default
$ python
Python 2.5.2 (r252:60911, Jul 22 2009, 15:35:03)
[GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
    

import wx
wx.version()
          

'2.8.10.1 (gtk2-unicode)'
    

import wx.webkit
app = wx.PySimpleApp()
frame = wx.Frame(None)
web = wx.webkit.WebKitCtrl(frame)
          
That should be

import wx.webview
web = wx.webview.WebView(frame)

Note that you need to add ~/tmp/wxwebkit/WebKitBuild/Debug.master to your PYTHONPATH and LD_LIBRARY_PATH for things to work.

wx.webkit.WebKitCtrl wraps Safari on Mac, it is not a cross-platform control and it predates the cross-platform wxWebKit project.

Perhaps in 2.9/3.0 we should deprecate this syntax and instead use something like wx.safari.SafariMacCtrl() to make things clearer...

Ok, I see, so even if I build wxPython I won' t get it, I have to also build wxwebkit then. How do I integrate it to my wxPython install/build? Do I just copy libwxwebkit.so to /usr/lib and copy webview.py webview.pyc _webview.so to /usr/lib/python2.5/site-packages/wx-2.8-gtk2-unicode/wx/ (on ubuntu)? I tried that and I get :

>>> import wx
>>> import wx.webview
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.5/site-packages/wx-2.8-gtk2-unicode/wx/webview.py", line 325, in <module>
    class wxWebView(wx._core.wxWindow):
NameError: name 'wx' is not defined

I tried exporting as you said and then import it relatively but I get this :

>>> import wx
>>> import webview
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "webview.py", line 60, in <module>
    import _core
ImportError: No module named _core
>>>

Thank you,
Gabriel

···

On Dec 14, 2009, at 4:49 AM, Gabriel Rossetti wrote:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.5/site-packages/wx-2.8-gtk2-unicode/wx/webkit.py", line 72, in __init__
   _webkit.WebKitCtrl_swiginit(self,_webkit.new_WebKitCtrl(*args, **kwargs))
NotImplementedError

as you can see I'm still getting this error. Do I also have to build wxPython for it to work? If so once I have built it and finished the final steps :

$ python setup.py build_ext --inplace BUILD_GLCANVAS=0 BUILD_STC=0 BUILD_GIZMOS=0 WX_CONFIG=/tmp/wx/2.8/bin/wx-config
$ python setup.py install BUILD_GLCANVAS=0 BUILD_STC=0 BUILD_GIZMOS=0 WX_CONFIG=/tmp/wx/2.8/bin/wx-config

how do I get wxwebkit to integrate into wx? I didn't see a setup.py for it. I also wonder if it's necessary to buils wxwebkit if I build wxpython as wouldn't it be built directly by it?
    
Yes, wxPython does not include the cross-platform wxWebKit. I hope to spend some more time working out the issues with Ubuntu binaries soon.

Thanks,

Kevin

Thank you,
Gabriel

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en
    

James Helferty wrote:

···

On Dec 14, 7:49 am, Gabriel Rossetti <gabriel.rosse...@arimaz.com> > wrote:
  

Hello everyone,

I wanted to use wxwebkit but I got a NotImplementedError when trying to
use wx.webkit.WebKitCtrl().
    
The wx.webkit.WebKitCtrl wrapper bindings included in wxPython are
only available on the Mac because it wraps a native control. On all
other platforms, you'll get an exception if you try to use it.

wxWebKit is a different (more cross-platform) project, and appears to
have a completely different set of bindings. Looks like there's a
sample available here:

http://gitorious.org/wxwebkit/wxwebkit/blobs/master/WebKit/wx/bindings/python/samples/simple.py

James

Ok, thank you for that info and the link.

Gabriel