In my Programme. use two QLineEdit. First one is normal and second one is titled Line edit. First one/normal QLineEidt works smoothly, But In second textbox(QLineEdit), I cannot insert a text at begging or any where at a time.
for example : I entered a text "Python". Now I add "Hello" to begging of the text ("Hello Python"). If I try to type "Hello", I can insert only one word at a time, (press home key, type word "H",after that cursor jumps to end, once again we move cursor to second position and enter a word "O", Once we enter word "O" cursor jumps to end of the text and so on). I want to type(insert) a text at a stretch.
How to OverCome?
import sys
from PyQt5.QtWidgets import *
from PyQt5.QtGui import QFont
class Lineedit_title(QWidget):
def __init__(self):
super().__init__()
self.setGeometry(100,100,500,500)
self.textbox1 = QLineEdit(self)
self.textbox1.setGeometry(50,50,200,50)
self.textbox1.setFont(QFont("Caliber", 15, QFont.Bold))
self.textbox2 = QLineEdit(self)
self.textbox2.setGeometry(50,140,200,50)
self.textbox2.setFont(QFont("Caliber",15,QFont.Bold))
self.textbox2.textChanged.connect(self.textbox_textchange)
def textbox_textchange(self,txt):
self.textbox2.setText(txt.title())
def main():
app = QApplication(sys.argv)
win = Lineedit_title()
win.show()
sys.exit(app.exec_())
if __name__ == "__main__":
main()