Course Hive
Search

Welcome

Sign in or create your account

Continue with Google
or
Add CSS to Python in 10 minutes! ๐ŸŽจ
Play lesson

Python tutorial for beginners ๐Ÿ - Add CSS to Python in 10 minutes! ๐ŸŽจ

4.0 (0)
8 learners

What you'll learn

This course includes

  • 14.3 hours of video
  • Certificate of completion
  • Access on mobile and TV

Summary

Keywords

Full Transcript

#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__() self.button1 = QPushButton("#1") self.button2 = QPushButton("#2") self.button3 = QPushButton("#3") self.initUI() def initUI(self): central_widget = QWidget() self.setCentralWidget(central_widget) hbox = QHBoxLayout() hbox.addWidget(self.button1) hbox.addWidget(self.button2) hbox.addWidget(self.button3) central_widget.setLayout(hbox) self.button1.setObjectName("button1") self.button2.setObjectName("button2") self.button3.setObjectName("button3") self.setStyleSheet(""" 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__': app = QApplication(sys.argv) window = MainWindow() window.show() sys.exit(app.exec_())

Course Hive

Continue this lesson in the app

Install CourseHive on Android or iOS to keep learning while you move.

Related Courses

FAQs

Course Hive
Download CourseHive
Keep learning anywhere