Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. from PyQt5.QtWidgets import (QWidget,QApplication,QTextEdit,
  2. QInputDialog,QPushButton,QVBoxLayout,QProgressBar)
  3. import sys
  4.  
  5. class Tbx(QWidget):
  6. def __init__(self):
  7. super().__init__()
  8. self.initUI()
  9.  
  10. def initUI(self):
  11. self.vbox = QVBoxLayout()
  12. self.btn = QPushButton('ClickMe',self)
  13. self.btn.clicked.connect(self.dollar)
  14. self.te = QTextEdit(self)
  15. self.prgb = QProgressBar(self)
  16. self.vbox.addWidget(self.te)
  17. self.vbox.addWidget(self.btn)
  18. self.vbox.addWidget(self.prgb)
  19. self.setLayout(self.vbox)
  20. self.setGeometry(300,300,400,250)
  21. self.setWindowTitle('Application')
  22. self.show()
  23. def dollar(self):
  24. text_1_int , ok = QInputDialog.getInt(self,'HowMany?','Enter How Many dollar do you want ?')
  25. if not ok:
  26. return
  27. current_lines = self.te.toPlainText().split('n')
  28. new_lines = list()
  29. self.prgb.setMaximum(text_1_int + 1)
  30. for dollar_counter in range(1, text_1_int+1):
  31. word = '$'*dollar_counter
  32. new_lines += [word + text for text in current_lines]
  33. self.prgb.setValue(dollar_counter + 1)
  34. self.te.setPlainText('n'.join(new_lines))
  35.  
  36. if __name__ == '__main__':
  37. app = QApplication(sys.argv)
  38. ex = Tbx()
  39. sys.exit(app.exec_())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement