-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.py
More file actions
37 lines (25 loc) · 1.07 KB
/
main.py
File metadata and controls
37 lines (25 loc) · 1.07 KB
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
import PyQt5.QtWidgets as PyWidget
import PyQt5.QtGui as PyGui
class MainWindow(PyWidget.QWidget):
def __init__(self):
super().__init__()
self.setLayout(PyWidget.QVBoxLayout())
my_label = PyWidget.QLabel("Pick Something From The List Below", self)
my_label.setFont(PyGui.QFont('Helvetica', 24))
self.layout().addWidget(my_label)
my_combo = PyWidget.QComboBox(self,
editable=True,
insertPolicy=PyWidget.QComboBox.InsertAtBottom)
my_combo.addItem("Neapolitan Pizza")
my_combo.addItem("Chicago Pizza")
my_combo.insertItems(2,["California Pizza","Detroit Pizza"])
self.layout().addWidget(my_combo)
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 Picked {my_combo.currentText()}!')
app = PyWidget.QApplication([])
mw = MainWindow()
app.exec_()