문제

I'm using Python with PyQt and I have a few problems with my QLineEdits.

  1. First of all, I want to put text on them, but not the regular one, I mean the transparent text that disappears when you click on the QLineEdit.
  2. How can I disable clicking on my QLineEdit?
도움이 되었습니까?

해결책

Pretty much like this:

linedit = QtGui.QlineEdit()
linedit.setPlaceholderText("My grey text which disappear when I click on it")
linedit.setEnabled(False)

with Qt minimum version 4.7 and latest PyQt 4.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top