filmov
tv
Python PyQt5 add CSS-like properties easy! 🎨

Показать описание
#pythontutorial #python #pythonprogramming
00:00:00 intro
00:00:21 imports
00:00:47 buttons setup
00:01:35 layout manager
00:03:10 apply CSS to a class
00:06:12 apply CSS to an id
00:08:17 advanced colors
00:09:56 pseudo-classes
# PyQt5 setStyleSheet()
import sys
from PyQt5.QtWidgets import QApplication, QMainWindow, QPushButton, QWidget, QHBoxLayout
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
def initUI(self):
central_widget = QWidget()
hbox = QHBoxLayout()
QPushButton{
font-size: 40px;
font-family: Arial;
padding: 15px 75px;
margin: 25px;
border: 3px solid;
border-radius: 15px;
}
QPushButton#button1{
background-color: hsl(0, 100%, 64%);
}
QPushButton#button2{
background-color: hsl(122, 100%, 64%);
}
QPushButton#button3{
background-color: hsl(204, 100%, 64%);
}
QPushButton#button1:hover{
background-color: hsl(0, 100%, 84%);
}
QPushButton#button2:hover{
background-color: hsl(122, 100%, 84%);
}
QPushButton#button3:hover{
background-color: hsl(204, 100%, 84%);
}
""")
if ___name___ == '__main__':
window = MainWindow()
00:00:00 intro
00:00:21 imports
00:00:47 buttons setup
00:01:35 layout manager
00:03:10 apply CSS to a class
00:06:12 apply CSS to an id
00:08:17 advanced colors
00:09:56 pseudo-classes
# PyQt5 setStyleSheet()
import sys
from PyQt5.QtWidgets import QApplication, QMainWindow, QPushButton, QWidget, QHBoxLayout
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
def initUI(self):
central_widget = QWidget()
hbox = QHBoxLayout()
QPushButton{
font-size: 40px;
font-family: Arial;
padding: 15px 75px;
margin: 25px;
border: 3px solid;
border-radius: 15px;
}
QPushButton#button1{
background-color: hsl(0, 100%, 64%);
}
QPushButton#button2{
background-color: hsl(122, 100%, 64%);
}
QPushButton#button3{
background-color: hsl(204, 100%, 64%);
}
QPushButton#button1:hover{
background-color: hsl(0, 100%, 84%);
}
QPushButton#button2:hover{
background-color: hsl(122, 100%, 84%);
}
QPushButton#button3:hover{
background-color: hsl(204, 100%, 84%);
}
""")
if ___name___ == '__main__':
window = MainWindow()
Комментарии