-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
119 lines (95 loc) · 3.32 KB
/
main.py
File metadata and controls
119 lines (95 loc) · 3.32 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
import sys
# from PyQt5.QtWidgets import QApplication, QMainWindow, QWidget
# from PyQt5.QtGui import QPalette, QColor
from PyQt5 import *
from PyQt5.QtGui import QPalette, QColor
from PyQt5.QtWidgets import QMainWindow, QVBoxLayout, QWidget, QApplication, QLineEdit, QGridLayout, QHBoxLayout, \
QLabel, QPushButton
class MainWindow(QMainWindow):
def __init__(self):
super(MainWindow, self).__init__()
self.setWindowTitle("My App")
self.setGeometry(0,0,1000,500)
layout = QHBoxLayout()
grid_layout = QGridLayout()
vertical_layout = QVBoxLayout()
param1 = QLabel()
param1.setText('Parameter1')
grid_layout.addWidget(param1, 0, 0)
param2 = QLabel()
param2.setText('Parameter1')
grid_layout.addWidget(param2, 1, 0)
param3 = QLabel()
param3.setText('Parameter1')
grid_layout.addWidget(param3, 2, 0)
grid_layout.addWidget(Text(), 0, 1)
grid_layout.addWidget(Text(), 1, 1)
grid_layout.addWidget(Text(), 2, 1)
layout.addLayout(grid_layout)
button = QPushButton()
button.setText('Btn')
calculate_price = QLabel()
calculate_price.setText("""
Material use:
Price per 1:
Overall price:
""")
calculate_price.setStyleSheet("background-color: blue;font-size:18px;font-family:Calibri Light;")
vertical_layout.addWidget(button)
vertical_layout.addWidget(calculate_price)
layout.addLayout(vertical_layout)
widget = QWidget()
widget.setLayout(layout)
self.setCentralWidget(widget)
# self.setWindowTitle("My App")
#
# layout1 = QHBoxLayout()
# layout2 = QVBoxLayout()
# layout3 = QVBoxLayout()
#
# layout2.addWidget(Color('red'))
# layout2.addWidget(Color('yellow'))
# layout2.addWidget(Color('purple'))
#
# layout1.addLayout(layout2)
#
# layout1.addWidget(Color('green'))
#
# layout3.addWidget(Color('red'))
# layout3.addWidget(Color('purple'))
#
# layout1.addLayout(layout3)
#
# widget = QWidget()
# widget.setLayout(layout1)
# self.setCentralWidget(widget)
class Color(QWidget):
def __init__(self, color):
super(Color, self).__init__()
self.setAutoFillBackground(True)
palette = self.palette()
palette.setColor(QPalette.Window, QColor(color))
self.setPalette(palette)
class Text(QWidget):
def __init__(self):
super(Text, self).__init__()
self.title = 'PyQt5 textbox - pythonspot.com'
self.left = 10
self.top = 10
self.width = 400
self.height = 140
self.setGeometry(self.left, self.top, self.width, self.height)
self.textbox = QLineEdit(self)
self.textbox.move(20, 20)
self.textbox.resize(280, 40)
# class Button(QWidget):
# def __init__(self, text):
# super(Button, self).__init__()
# self.text = text
# button = QPushButton()
# button.setText(text)
# button.show()
app = QApplication(sys.argv)
window = MainWindow()
window.show()
app.exec()