[PyKDE] QWidget.winId() not working?

Smith, Dave dts at iti-oh.com
Wed May 1 15:08:00 BST 2002


Thanks Phil!  I guess I didn't look far enough...

Sure enough, I get the expected results on any UNIX.

Anyone have a clue how to get a useful winId out of
Windows at the python/PyQt level?

In C++ I'm looking at code that gets the winId like this:
   long my_windowid = (long)((QWidget *) this)->winId();

Of course, I don't fully understand that code yet, which
is why I'm trying to do something simple in python first.  :)

Dave


-----Original Message-----
From: Phil Thompson [mailto:phil at river-bank.demon.co.uk]
Sent: Wednesday, May 01, 2002 5:31 AM
To: Smith, Dave
Cc: PyQt/KDE Mailing List (E-mail)
Subject: Re: [PyKDE] QWidget.winId() not working?


"Smith, Dave" wrote:
> 
> Looks like QWidget.winId() is broken in at least PyQt 3.1.  When I try to use it I get:
> 
> Python 2.2 (#28, Dec 21 2001, 12:21:22) [MSC 32 bit (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> from qt import *
> >>> qApp = QApplication([])
> >>> button = QPushButton(None)
> >>> button.winId()
> <PyCObject object at 0x007E9DA0>
> >>>
> 
> According to the PyQt documentation it is implemented.
> 
> I was expecting an integer value to be returned, in Qt, WId
> is declared as 'typedef int WId;' in qwindowdefs.h.

I think you are mis-reading qwindowdefs.h. It's an int like type on
everything except Windows.

Phil




More information about the PyQt mailing list