Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from PyQt5.QtWidgets import (QWidget,QApplication,QTextEdit,
- QInputDialog,QPushButton,QVBoxLayout,QProgressBar)
- import sys
- class Tbx(QWidget):
- def __init__(self):
- super().__init__()
- self.initUI()
- def initUI(self):
- self.vbox = QVBoxLayout()
- self.btn = QPushButton('ClickMe',self)
- self.btn.clicked.connect(self.dollar)
- self.te = QTextEdit(self)
- self.prgb = QProgressBar(self)
- self.vbox.addWidget(self.te)
- self.vbox.addWidget(self.btn)
- self.vbox.addWidget(self.prgb)
- self.setLayout(self.vbox)
- self.setGeometry(300,300,400,250)
- self.setWindowTitle('Application')
- self.show()
- def dollar(self):
- text_1_int , ok = QInputDialog.getInt(self,'HowMany?','Enter How Many dollar do you want ?')
- if not ok:
- return
- current_lines = self.te.toPlainText().split('n')
- new_lines = list()
- self.prgb.setMaximum(text_1_int + 1)
- for dollar_counter in range(1, text_1_int+1):
- word = '$'*dollar_counter
- new_lines += [word + text for text in current_lines]
- self.prgb.setValue(dollar_counter + 1)
- self.te.setPlainText('n'.join(new_lines))
- if __name__ == '__main__':
- app = QApplication(sys.argv)
- ex = Tbx()
- sys.exit(app.exec_())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement