-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
39 lines (28 loc) · 1.2 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import PyQt5.QtWidgets as PyWidget
import PyQt5.QtGui as PyGui
class MainWindow(PyWidget.QWidget):
def __init__(self):
super().__init__()
self.setWindowTitle("Hello World!!")
self.setLayout(PyWidget.QVBoxLayout())
my_label = PyWidget.QLabel("Type Something Into The Box Below", self)
my_label.setFont(PyGui.QFont('Helvetica', 24))
self.layout().addWidget(my_label)
my_text = PyWidget.QTextEdit(self,
plainText="This is real text!",
acceptRichText=False,
lineWrapColumnOrWidth=75,
placeholderText="Hello World!",
readOnly=False
)
self.layout().addWidget(my_text)
my_button = PyWidget.QPushButton("Press Me!",
clicked=lambda: press_it())
self.layout().addWidget(my_button)
self.show()
def press_it():
my_label.setText(f'You Typed {my_text.toPlainText()}!')
my_text.setPlainText("You Pressed The Button!")
app = PyWidget.QApplication([])
mw = MainWindow()
app.exec_()