[PyQt] QUdpSocket problem
Phil Thompson
phil at riverbankcomputing.com
Thu Apr 10 09:30:44 BST 2008
On Thursday 10 April 2008, İsmail Dönmez wrote:
> Hi all,
>
> In Qt following works :
>
> QUdpSocket sock = new QUdpSocket();
> sock.bind(QHostAdress.Any, 4444)
>
> But in PyQt it doesn't like it :
> >>> sock = QUdpSocket()
> >>> sock.bind(QHostAddress.Any, 4444)
>
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> TypeError: argument 2 of QUdpSocket.bind() has an invalid type
>
> However if I don't use an enum it works :
> >>> sock.bind(QHostAddress("0.0.0.0"), 4444)
>
> True
>
> Any ideas?
PyQt doesn't have the same level of auto-conversions that C++ has. Use
QHostAddress(QHostAddress.Any).
Phil
More information about the PyQt
mailing list