The UI is as following
The UI is as following
I saved the form as a file named re.ui
Then I convert it into Python script named ui_re.py
Third ,I create the source file with the name
callFirstApp.pyw and import the ui_re.py to it
The code in the callFirstApp.pyw is as shown here:
@
import sys
from PySide.QtGui import *
from ui_re import *
class MainWindow(QMainWindow, Ui_MainWindow):
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
self.setupUi(self)
self.plainTextEdit.setPlainText("Type code here...")
if __name__ == '__main__':
app =QApplication(sys.argv)
frame = MainWindow()
frame.show()
app.exec_()
@
I want to reimplement the QPlainText’s focusInEvent in this file ,my code is as following
(means let the default text "Type code here..." disappear when focus in the QTextEdit’s editable area)
@
def focusInEvent(self, event):
self.clear()
QPlainTextEdit.focusInEvent(self, event)
@
But I don’t know how to add the code to the file correctly ?
Thanks in advance .