View Full Version : convert c++ class to python code
alrawab
20th June 2012, 02:35
hi
how to write this in python :
class MyClass : public QWidget {
Q_OBJECT
MyClass::MyClass(otherclass * _zz):QWidget(_zz.somefunc),zz(_zz)
ChrisW67
20th June 2012, 03:12
That incomplete fragment of C++ probably looks something like this incomplete fragment of Python for PyQt:
from PyQt4 import QtCore,QtGui
class MyClass(QtGui.QWidget):
def __init__(self, _zz):
QtGui.QWidget.__init__(self, _zz.somefunc())
self.zz = _zz
but I am not a real Python-head
alrawab
20th June 2012, 04:01
thanks a lot
amleto
20th June 2012, 08:28
That incomplete fragment of C++ probably looks something like this incomplete fragment of Python for PyQt:
from PyQt4 import QtCore,QtGui
class MyClass(QtGui.QWidget):
def __init__(self, _zz):
QtGui.QWidget.__init__(self, _zz.somefunc())
self.zz = _zz
but I am not a real Python-head
you added the method call parens onto somefunc which isnt present in the c++.
ChrisW67
20th June 2012, 09:35
... which is why I prefaced it with "looks something like" ;)
wysota
20th June 2012, 10:06
In theory "somefunc" might be a variable ;)
alrawab
25th June 2012, 04:54
In theory "somefunc" might be a variable ;)
or may might be a a car ?
amleto
25th June 2012, 08:23
insightful...
wysota
25th June 2012, 08:43
or may might be a a car ?
It might even be a pointer to a function returning a car :)
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.