pydev 代码完成以及 pyqt 和 qt4 中的鸭子输入
您好,由于代码完成,我刚刚安装了 pydev。 我的第一个草图是一些简单的 qt 小部件。
我正在 ovverriding mouseMoveEvent:
def mouseMoveEvent(self, event):
mouse = event.pos()
现在..我知道 event 变量是 QtCore.QPoint 类型..但是代码完成不起作用..好吧,我明白了:没有硬输入,有鸭子打字,理论上事件可以是任何可能的类型..
相反,如果我有这个代码:
point = QtCore.QPoint()
当我写 point. 代码完成工作正常(当然它毫无疑问知道类型!)
我想要代码完成也在重写 mouseMoveEvent 中..除了更改语言和在 c++ 或 java 中切换之外我还能做什么?
def mouseMoveEvent(self, event):
assert(isinstance(event, QtGui.QMouseEvent))
mouse = event.
Hello i have just installed pydev because of code completition.
my first sketch is some simple qt widget.
i'm ovverriding mouseMoveEvent:
def mouseMoveEvent(self, event):
mouse = event.pos()
now.. i know that event variable is a QtCore.QPoint type.. but code completition does not work.. ok i understand it: there is no hard typing, there is duck typing, in theory event could be of any possible type..
instead if i have this code:
point = QtCore.QPoint()
when i write point. code completition works fine (of course it knows the type without doubt!)
i want code completition also in overriding mouseMoveEvent.. what else can i do besides change language and shift in c++ or java?
SOLUTION:
as gary pointed me in this thread this trick works:
def mouseMoveEvent(self, event):
assert(isinstance(event, QtGui.QMouseEvent))
mouse = event.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我确信这不是 Python 的问题,而是 PyDev 设置方式的问题。
有很多可用的 Python IDE 可以毫无问题地处理您提到的代码完成类型 - 例如 eric ,例如。
因此,如果你不能让 PyDev 做正确的事情,答案不是切换语言,而是切换 IDE。
I'm certain that this is not a problem Python, but rather with how your PyDev is set up.
There are plenty of Python IDE's available that have no problem handling the sort of code-completion you mention - such as eric, for instance.
So if you can't get PyDev to do the right thing, the answer is not to switch languages, but to switch IDE's.