0
我試圖改變我的Qpainter的大小,我無法弄清楚怎麼可能有人在這裏幫助我的代碼,我看了網上,我不能弄明白,因爲我需要的代碼是嵌入感謝您的幫助,不需要其他代碼。蟒蛇調整Qpainter
import sys
import os
from PyQt4.QtCore import QSize, QTimer
from PyQt4.QtGui import QApplication,QGraphicsRectItem , QMainWindow, QPushButton, QWidget, QIcon, QLabel, QPainter, QPixmap, QMessageBox, QAction, QKeySequence, QFont, QFontMetrics, QMovie
from PyQt4 import QtGui
class UIWindow(QWidget):
def __init__(self, parent=None):
super(UIWindow, self).__init__(parent)
self.resize(QSize(400, 450))
def paintEvent(self, event):
painter = QPainter(self)
painter.drawPixmap(self.rect(), QPixmap("Images\Image.png"))
painter.move(0,0)
painter.resize(950,270)
class MainWindow(QMainWindow,):
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
self.setGeometry(490, 200, 950, 620)
self.setFixedSize(950, 620)
self.startUIWindow()
self.setWindowIcon(QtGui.QIcon('Images\Logo.png'))
def startUIWindow(self):
self.Window = UIWindow(self)
self.setWindowTitle("pythonw")
self.setCentralWidget(self.Window)
self.show()
if __name__ == '__main__':
app = QApplication(sys.argv)
w = MainWindow()
sys.exit(app.exec_())
'QPainter'沒有'move()'方法,你想要做什麼? – eyllanesc
QPainter是負責繪製小部件的類,它不是小部件或畫筆。 – eyllanesc
@eyllanesc我試圖讓我的圖像出現在程序不同的頂部,而不是在中心和全部扭曲 – Tyrell