# coding:utf-8 import sys from PyQt5.QtCore import Qt from PyQt5.QtWidgets import QApplication, QWidget from slider import Slider class Window(QWidget): def __init__(self, parent=None): super().__init__(parent=parent) self.resize(300, 90) self.hSlider = Slider(Qt.Horizontal, self) self.hSlider.setValue(20) self.hSlider.move(56, 30) with open('resource/slider.qss', encoding='utf-8') as f: self.setStyleSheet(f.read()) if __name__ == '__main__': app = QApplication(sys.argv) w = Window() w.show() sys.exit(app.exec_())