[PyQt] Unable to get the wrapping Class by sip

燕子 xiaoyan0325 at tom.com
Tue Dec 15 01:36:42 GMT 2009


I'm on Windows using Microsoft Visual Stdio2008,  Python 3.1,  PyQt-win-gpl-4.6.2,  sip-4.9.2  and Qt 4.5.3.
First,I have myqtlibtest.h; myqtlibtest.lib;myqtlibtest.dll from the myqtlibtest project.It's  simple.Just like this:
  
 myqtlibtest.h:
  
 #ifndef MYQTLIBTEST_H
#define MYQTLIBTEST_H
 #include "myqtlibtest_global.h"
 #include <qstring.h>
#include <qdebug.h>
 class MYQTLIBTEST_EXPORT myqtlibtest
{
public:
 myqtlibtest();
 ~myqtlibtest();
 void show(){
  qDebug()<<QString("hello");
 }
 private:
 };
 #endif // MYQTLIBTEST_H
 
 
when I wrap with SIP. Then my  sip file is like this:
  
 myqtlibtest.sip:
  
 %Module myqtlibtest 0
 %Import C:/Python31/Lib/site-packages/PyQt4/sip/PyQt4/QtCore/QtCoremod.sip
  
 %If (Qt_4_5_3 -)
 
class  myqtlibtest
{
 %TypeHeaderCode
 #include "myqtlibtest.h"
 %End
 public:
 myqtlibtest();
 ~myqtlibtest();
 void show();
private:
 };
%End
  
 I'd like to add Qt classes to my python program.

I've gotten the file of myqtlibtest.pyd by my sip file, but when I run my myqtlibtest.pyd ,I got nothing just like this:
 when I run it on python idle.(myqtlibtest is my module)
  
  
>>> import myqtlibtest
 
>>> help(myqtlibtest)
 
Help on module myqtlibtest:
 
 
 
NAME
 
    myqtlibtest
 
 
 
FILE
 
    c:\python31\dlls\myqtlibtest.pyd
 
 
 
 >>> myqtlibtest.myqtlibtest()
Traceback (most recent call last):
  File "<pyshell#11>", line 1, in <module>
    myqtlibtest.myqtlibtest()
AttributeError: 'module' object has no attribute 'myqtlibtest'
>>> a=myqtlibtest.myqtlibtest()
Traceback (most recent call last):
  File "<pyshell#12>", line 1, in <module>
    a=myqtlibtest.myqtlibtest()
AttributeError: 'module' object has no attribute 'myqtlibtest'
>>> 

Where is the wrapping class?
Any help? Thanks - susan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20091215/a0f56fa0/attachment.html


More information about the PyQt mailing list