Python PyQt5.QtCore.Qt 模块,SmoothTransformation() 实例源码

我们从Python开源项目中,提取了以下17个代码示例,用于说明如何使用PyQt5.QtCore.Qt.SmoothTransformation()

项目:MusicNet    作者:vidursatija    | 项目源码 | 文件源码
def drawUI(self, song_name="blank", song_artist="blank"):
        self.art = QLabel(self)
        self.art.resize(50, 50)
        #self.art.setPixmap(QPixmap("".join([song_name,'.jpg'])).scaled(50, 50, Qt.KeepAspectRatio, Qt.SmoothTransformation))

        self.song_label = QLabel(self)
        self.song_label.setText(song_name)
        self.song_label.setStyleSheet("border-image: rgba(0, 0, 0, 0); color: rgba(255, 255, 255); font-size: 12pt; font-weight: 600;")
        self.song_label.move(60, 10)
        self.song_label.resize(180, 15)

        self.artist_label = QLabel(self)
        self.artist_label.setText(song_artist)
        self.artist_label.setStyleSheet("border-image: rgba(0, 0, 0, 0); color: rgba(255, 255, 255); font-size: 12pt; font-weight: 200;")
        self.artist_label.move(60, 25)
        self.artist_label.resize(180, 15)
项目:MusicNet    作者:vidursatija    | 项目源码 | 文件源码
def drawUI(self):
        self.play = QPushButton(self)
        self.play.setIconSize(QSize(40, 40))
        self.play.setIcon(QIcon(QPixmap("play.png").scaled(40, 40, Qt.KeepAspectRatio, Qt.SmoothTransformation)))
        self.play.setStyleSheet("background-color: rgba(0, 0, 0, 0);")
        self.play.clicked.connect(lambda:self.playpause(self.play))
        self.resize(50, 50)
项目:MusicNet    作者:vidursatija    | 项目源码 | 文件源码
def playpause(self, btn):
        if self.playing:
            os.system("""osascript -e 'tell application "iTunes" to pause'""")
            self.playing = False
            btn.setIcon(QIcon(QPixmap("play.png").scaled(40, 40, Qt.KeepAspectRatio, Qt.SmoothTransformation)))
        else:
            os.system("""osascript -e 'tell application "iTunes" to play'""")
            self.playing = True
            btn.setIcon(QIcon(QPixmap("pause.png").scaled(40, 40, Qt.KeepAspectRatio, Qt.SmoothTransformation)))
项目:MusicNet    作者:vidursatija    | 项目源码 | 文件源码
def drawUI(self):
        self.play = QPushButton(self)
        self.play.setIconSize(QSize(40, 20))
        self.play.setIcon(QIcon(QPixmap("fastforward.png").scaled(40, 20, Qt.KeepAspectRatio, Qt.SmoothTransformation)))
        self.play.setStyleSheet("background-color: rgba(0, 0, 0, 0);")
        self.play.clicked.connect(lambda:self.forward())
        self.resize(80, 40)
项目:MusicNet    作者:vidursatija    | 项目源码 | 文件源码
def drawUI(self):
        self.play = QPushButton(self)
        self.play.setIconSize(QSize(40, 20))
        self.play.setIcon(QIcon(QPixmap("rewind.png").scaled(40, 20, Qt.KeepAspectRatio, Qt.SmoothTransformation)))
        self.play.setStyleSheet("background-color: rgba(0, 0, 0, 0);")
        self.play.clicked.connect(lambda:self.rewind())
        self.resize(80, 40)
项目:pyqt5    作者:yurisnm    | 项目源码 | 文件源码
def init_ui(self):
        self._fileDialog = QFileDialog(self)
        self._v_layout = QVBoxLayout()
        self._v_layout.setSpacing(2)
        self.setLayout(self._v_layout)
        self._path = "TEXT.png"
        self._pixmap = QPixmap(self._path)
        self._btnFile = QPushButton("Open")
        self._hWidget = QWidget()
        self._hLayout = QHBoxLayout()
        self._hWidget.setLayout(self._hLayout)

        self._image = Image.open(self._path)
        self._line = QLineEdit()

        self._hLayout.addWidget(self._btnFile)
        self._hLayout.addWidget(self._line)
        size = QSize(160, 90)
        pix = self._pixmap.scaled(size, transformMode=Qt.SmoothTransformation)

        self._lbl = QLabel()
        self._lbl.setPixmap(pix)
        self._v_layout.addWidget(self._lbl)
        self._v_layout.addWidget(self._hWidget)
        self._btnFile.clicked.connect(self.openFilePressed)

        self._line.setText(pytesseract.image_to_string(Image.open('TEXT.png')))
项目:pyqt5    作者:yurisnm    | 项目源码 | 文件源码
def openFilePressed(self):
        self._path = self._fileDialog.\
            getOpenFileName(self, "Image Files (*.png *.jpg)")
        if self._path[0] != "":
            self._pixmap = QPixmap(self._path[0])
            size = QSize(160, 90)
            pix = self._pixmap.scaled(size,
                                      transformMode=Qt.SmoothTransformation)
            self._lbl.setPixmap(pix)
            self._image = Image.open(self._path[0])
            text = pytesseract.image_to_string(self._image)
            self._line.setText(text)
项目:pyqt5    作者:yurisnm    | 项目源码 | 文件源码
def updateText(self):

        self._pixmap = QPixmap('TEXT.png')
        size = QSize(160, 90)

        pix = self._pixmap.scaled(size,
                                  transformMode=Qt.SmoothTransformation)
        self._lbl.setPixmap(pix)
        self._image = Image.open('TEXT.png')
        text = pytesseract.image_to_string(self._image, lang='eng', config='-psm 8', )
        self._line.setText(text)
        self.signal_send_text.emit(text)
项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
def updateScreenshotLabel(self):
        self.screenshotLabel.setPixmap(self.originalPixmap.scaled(
                self.screenshotLabel.size(), Qt.KeepAspectRatio,
                Qt.SmoothTransformation))
项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
def processCapturedImage(self, requestId, img):
        scaledImage = img.scaled(self.ui.viewfinder.size(), Qt.KeepAspectRatio,
                Qt.SmoothTransformation)

        self.ui.lastImagePreviewLabel.setPixmap(QPixmap.fromImage(scaledImage))

        self.displayCapturedImage()
        QTimer.singleShot(4000, self.displayViewfinder)
项目:examples    作者:pyqt    | 项目源码 | 文件源码
def updateScreenshotLabel(self):
        self.screenshotLabel.setPixmap(self.originalPixmap.scaled(
                self.screenshotLabel.size(), Qt.KeepAspectRatio,
                Qt.SmoothTransformation))
项目:examples    作者:pyqt    | 项目源码 | 文件源码
def processCapturedImage(self, requestId, img):
        scaledImage = img.scaled(self.ui.viewfinder.size(), Qt.KeepAspectRatio,
                Qt.SmoothTransformation)

        self.ui.lastImagePreviewLabel.setPixmap(QPixmap.fromImage(scaledImage))

        self.displayCapturedImage()
        QTimer.singleShot(4000, self.displayViewfinder)
项目:PointlessMaker    作者:aboood40091    | 项目源码 | 文件源码
def loadTileset(self, mode, theme):
        globals.Tiles = []

        widths = {"M1": 16, "M3": 16, "MW": 16, "WU": 64}
        themes = {0: "plain", 1: "underground", 2: "castle", 3: "airship", 4: "water", 5: "hauntedhouse"}

        width = widths[mode]

        Tileset = QtGui.QPixmap('tilesets/%s_Field_%s.png' % (mode, themes[theme]))
        xcount = Tileset.width() // width
        ycount = Tileset.height() // width
        sourcex = 0
        sourcey = 0

        for y in range(ycount):
            for x in range(xcount):
                if mode == "WU":
                    if globals.TileWidth != 60:
                        bmp = Tileset.copy(sourcex + 2, sourcey + 2,
                                           width - 4, width - 4).scaledToWidth(globals.TileWidth, Qt.SmoothTransformation)

                    else:
                        bmp = Tileset.copy(sourcex + 2, sourcey + 2, width - 4, width - 4)

                else:
                    if globals.TileWidth != width:
                        bmp = Tileset.copy(sourcex, sourcey,
                                           width, width).scaledToWidth(globals.TileWidth, Qt.SmoothTransformation)

                    else:
                        bmp = Tileset.copy(sourcex, sourcey, width, width)

                globals.Tiles.append(bmp)
                sourcex += width
            sourcex = 0
            sourcey += width
项目:BannerFactory    作者:xuning0    | 项目源码 | 文件源码
def scale_image_to_aspect_fit_label(self, qpixmap):
        if qpixmap:
            scaled_image = qpixmap.scaled(self.image_view.size(), Qt.KeepAspectRatio | Qt.SmoothTransformation)
            self.image_view.setPixmap(scaled_image)
项目:pyqt5-example    作者:guinslym    | 项目源码 | 文件源码
def updateScreenshotLabel(self):
        self.screenshotLabel.setPixmap(self.originalPixmap.scaled(
                self.screenshotLabel.size(), Qt.KeepAspectRatio,
                Qt.SmoothTransformation))
项目:pyqt5-example    作者:guinslym    | 项目源码 | 文件源码
def processCapturedImage(self, requestId, img):
        scaledImage = img.scaled(self.ui.viewfinder.size(), Qt.KeepAspectRatio,
                Qt.SmoothTransformation)

        self.ui.lastImagePreviewLabel.setPixmap(QPixmap.fromImage(scaledImage))

        self.displayCapturedImage()
        QTimer.singleShot(4000, self.displayViewfinder)
项目:MusicNet    作者:vidursatija    | 项目源码 | 文件源码
def drawUI(self):

        self.alpha_rect = QLabel(self)
        self.alpha_rect.setPixmap(QPixmap("black_alpha.png").scaled(320, 480, Qt.KeepAspectRatio, Qt.SmoothTransformation))

        self.current_song = SongWidget(self)
        self.current_song.drawUI()
        self.current_song.move(40, 40)

        self.line1 = QLabel(self)
        self.line1.setPixmap(QPixmap('line.png').scaled(300, 1))
        self.line1.move(10, 120)

        self.time_line = QSlider(Qt.Horizontal, self)
        self.time_line.setGeometry(40, 135, 240, 4)
        self.time_line.setMaximum(157)
        self.time_line.setMinimum(0)
        self.time_line.setValue(0)
        self.time_line.setStyleSheet("""QSlider::groove:horizontal 
            {background-color: rgba(128, 128, 128, 0.5); border: 1px solid rgba(128, 128, 128, 0.5); border-radius: 2px; height:4px;} 
            QSlider::handle:horizontal 
            {border: 1px solid #fff;width: 4px;height: 4px;border-radius: 2px; background-color: #fff;}
            QSlider::sub-page:horizontal
            {background-color: #fff;}
            """)
        self.time_line.sliderReleased.connect(self.changeTime)

        self.rewind = RewindBtn(self)
        self.rewind.move(50, 175)

        self.play = StateBtn(self)
        self.play.move(135, 165)

        self.fastforward = ForwardBtn(self)
        self.fastforward.move(220, 175)

        self.line2 = QLabel(self)
        self.line2.setPixmap(QPixmap('line.png').scaled(300, 1))
        self.line2.move(10, 240)

        self.r_song.append(SongWidget(self))
        self.r_song[0].drawUI()
        self.r_song[0].move(40, 270)

        self.r_song.append(SongWidget(self))
        self.r_song[1].drawUI()
        self.r_song[1].move(40, 330)

        self.r_song.append(SongWidget(self))
        self.r_song[2].drawUI()#, song_loc="/Users/vidursatija/Music/iTunes/iTunes Media/Music/Halsey/hopeless fountain kingdom (Deluxe)/01 The Prologue.mp3")
        self.r_song[2].move(40, 390)

        self.timer = QTimer(self)
        self.timer.timeout.connect(self.updateLabels)
        self.timer.start(1000)